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

Support setting other defaults in the re-usable agent besides cookies. #453

Closed
wants to merge 1 commit into from

Conversation

markstos
Copy link

Since superagent 3.8, there has been support for the re-usable agent
supporting other defaults besides cookies.

For example, it's particularly useful to set default 'Authorization'
header before running repeated tests against an authenticated API.

I tracked down which version of superagent we needed to use as a
minimum dependency to this commit:

ladjs/superagent@66aed34

This update should be considered a bug fix, as 'supertest' claims to
support all of superagent's features, but this feature is documented in
superagent, but wasn't working in `supertest'.

@mohamed-mehany
Copy link

mohamed-mehany commented Apr 19, 2018

The global set issue #411 could also be solved with this, @mikelax could you please check?

@vjustov vjustov mentioned this pull request Apr 27, 2018
@markstos
Copy link
Author

Any feedback on this?

@noinkling
Copy link

noinkling commented Sep 10, 2018

I was trying to use this feature (as documented by Superagent) and was surprised when it didn't work. Given that the current version of Supertest already depends on superagent@^3.8.3, is there any reason this shouldn't be merged? It would simply be matching Superagent's behaviour:

https://github.com/visionmedia/superagent/blob/295dfcdacedd45e43a22d250bcaac6bf3d0a9229/lib/node/agent.js#L83

Having to write wrapper functions currently to apply defaults is no fun.

@markstos Maybe rebasing to remove the conflicts might help ease things along? The dependency version change is no longer required at least.

    Since `superagent` 3.8, there has been support for the re-usable agent
    supporting other defaults besides cookies.

    For example, it's particularly useful to set default 'Authorization'
    header before running repeated tests against an authenticated API.

    I tracked down which version of `superagent` we needed to use as a
    minimum dependency to this commit:

    ladjs/superagent@66aed34

    This update should be considered a bug fix, as 'supertest' claims to
    support all of superagent's features, but this feature is documented in
    superagent, but wasn't working in `supertest'.
@markstos
Copy link
Author

I've now re-based this to address conflicts. Feedback is appreciated.

@coveralls
Copy link

coveralls commented Sep 10, 2018

Pull Request Test Coverage Report for Build 332

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 97.297%

Totals Coverage Status
Change from base Build 330: 0.01%
Covered Lines: 137
Relevant Lines: 141

💛 - Coveralls

@JSteunou
Copy link

JSteunou commented Dec 7, 2018

@mikelax this is the supertest missing feature, any chance to get this in?

@markstos
Copy link
Author

markstos commented Dec 7, 2018

Why not merge this on December 28th, 2018, to celebrate the one year anniversary of the pull request?

@samikarak
Copy link

still waiting for this feature ... seems to be already solved, but not merged ....

@noinkling
Copy link

Should be fixed by #539 in v4.0

(I have no idea why that PR was merged but this one got no attention)

@bdharrington7
Copy link

Didn't know this was outstanding. Things get missed, looks like there was a transition in maintainers since this PR was opened.

@rimiti
Copy link
Contributor

rimiti commented Mar 10, 2019

Same feature has been merged into v4.0.0 🚀

Related PR: #539 (comment)

Thank you everybody for your contributions 🙏

@rimiti rimiti closed this Mar 10, 2019
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

8 participants