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

When running as Agent superagent defaults not set. #214

Open
bkuker opened this issue Jun 29, 2018 · 1 comment
Open

When running as Agent superagent defaults not set. #214

bkuker opened this issue Jun 29, 2018 · 1 comment

Comments

@bkuker
Copy link

bkuker commented Jun 29, 2018

Code like this does not work:

var agent = chai.request.agent(urls.central).auth(su.username, su.password);

The default auth is NOT used in subsequent requests made with this agent, contrary to the superagent documentation at http://visionmedia.github.io/superagent/#agents-for-global-state

If you look at this line of SuperAgent:

https://github.com/visionmedia/superagent/blob/66aed3427f29bf0c09b1df0e7f8aa9f0e30732ab/lib/node/agent.js#L83

You see the call to _setDefaults.

The corresponding code in chai-http, https://github.com/chaijs/chai-http/blob/master/lib/request.js#L323 where it overrides the methods, is missing this call to setDefaults.

bkuker added a commit to bkuker/chai-http that referenced this issue Jun 29, 2018
@bkuker
Copy link
Author

bkuker commented Jun 29, 2018

See PR #215 for my best suggestion, it fixes my use case but I am not familiar enough with superagent and chai-http to be totally sure.

bkuker added a commit to bkuker/chai-http that referenced this issue Jul 16, 2018
bkuker added a commit to bkuker/chai-http that referenced this issue Aug 14, 2018
bkuker added a commit to bkuker/chai-http that referenced this issue Aug 27, 2018
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

1 participant