mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
doc: add comment to example about 2xx status codes
Fixes: https://github.com/nodejs/node/issues/29714 PR-URL: https://github.com/nodejs/node/pull/34223 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
@@ -2236,6 +2236,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}`);
|
||||
|
||||
Reference in New Issue
Block a user