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

trustLocalhost() block removed #563

Merged
merged 1 commit into from Mar 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 0 additions & 15 deletions README.md
Expand Up @@ -81,21 +81,6 @@ describe('GET /user', function() {
});
```

If you need to test with HTTPS against localhost, you can use superagent's `.trustLocalhost()`, which let's you bypass any errors related to broken/insecure HTTPS on localhost.

```js
describe('GET /user', function() {
it('responds with json via HTTPS on localhost', function(done) {
request(app)
.get('/user')
.trustLocalhost()
.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