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

Apply plugins when used as superagent.method(...args, callback) #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shesek
Copy link

@shesek shesek commented Jan 24, 2018

superagent.method(...args, callback) currently fails to properly apply the plugins, because the request is already sent by the time the plugins are applied with use(). This patch fixes that.

@koenpunt
Copy link
Owner

Didn’t know about this usage. Can you add tests for this? Also follow the current code style (e.g. semicolons)

Otherwise, the request is already sent by the time we apply the plugins with `request.use()`.
@shesek
Copy link
Author

shesek commented Jan 31, 2018

Force-pushed the requested changes. The tests required some creativity to get it not to actually send the requests out, by overriding req.end. Open to other suggestions.

@shesek
Copy link
Author

shesek commented Jan 31, 2018

Is using arrow functions in the tests considered okay? Just noticed that I'm breaking the convention with that too...

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

Successfully merging this pull request may close these issues.

None yet

2 participants