Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.on() method not working. #13

Open
gutenye opened this issue Jan 25, 2016 · 2 comments
Open

.on() method not working. #13

gutenye opened this issue Jan 25, 2016 · 2 comments

Comments

@gutenye
Copy link

gutenye commented Jan 25, 2016

From the source index.js

Emitter(Context.prototype)

Just wonder, why not pass on() method to supeagent's request? instead of create your own emitter.

UPDATE

Although use() can make it works, that needs extra typings, and different from original way.

Besides the implementation at https://github.com/camshaft/superagent-defaults/blob/master/lib/context.js#L71 may cause bug.

Original on("reponse", fn) is called when actually made a HTTP request, while this one is called immediately (before make a HTTP request), that is different behavior than original implementation.

@larvanitis
Copy link

I just hit this problem. Is this project still active (Latest commit on Dec 2, 2015)?

Removing the custom emitter and this.emit('request', req) fixes this issue.

@larvanitis
Copy link

I created the above fork/pull request. Until it gets merged, you can install it with npm install "superagent-defaults@https://github.com/larvanitis/superagent-defaults/archive/0.2.0.tar.gz"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants