Skip to content

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

Open
shesek wants to merge 1 commit into
koenpunt:masterfrom
shesek:patch-1
Open

Apply plugins when used as superagent.method(...args, callback)#6
shesek wants to merge 1 commit into
koenpunt:masterfrom
shesek:patch-1

Conversation

@shesek
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants