Skip to content

Commit

Permalink
doc: add comment to example about 2xx status codes
Browse files Browse the repository at this point in the history
Fixes: #29714

PR-URL: #34223
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
jasnell authored and MylesBorins committed Jul 16, 2020
1 parent 6f014d0 commit 25ac669
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -2233,6 +2233,8 @@ http.get('http://nodejs.org/dist/index.json', (res) => {
const contentType = res.headers['content-type'];

let error;
// Any 2xx status code signals a successful response but
// here we're only checking for 200.
if (statusCode !== 200) {
error = new Error('Request Failed.\n' +
`Status Code: ${statusCode}`);
Expand Down

0 comments on commit 25ac669

Please sign in to comment.