Skip to content

When running as Agent superagent defaults not set. #214

Open
@bkuker

Description

@bkuker

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions