Skip to content

Commit

Permalink
auth info in README
Browse files Browse the repository at this point in the history
  • Loading branch information
oprogramador committed Oct 27, 2018
1 parent e910e85 commit 0146d81
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -65,6 +65,19 @@ describe('GET /user', function() {
});
```

You can use `auth` method to pass HTTP username and password in the same way as in the [superagent](http://visionmedia.github.io/superagent/#authentication):
```js
describe('GET /user', function() {
it('responds with json', function(done) {
request(app)
.get('/user')
.auth('username', 'password')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200, done);
});
});

One thing to note with the above statement is that superagent now sends any HTTP
error (anything other than a 2XX response code) to the callback as the first argument if
you do not add a status code expect (i.e. `.expect(302)`).
Expand Down

1 comment on commit 0146d81

@theronic
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is .auth(...) function defined?

Please sign in to comment.