diff options
author | James M Snell <jasnell@gmail.com> | 2020-07-06 22:33:10 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2020-07-09 17:35:37 +0300 |
commit | a720c0edcc40a86bee9a696cd791df3420c398ad (patch) | |
tree | 38753e73bc0c461d0dbf69194624adcd0f35541a /doc/api/http.md | |
parent | 14ac6e42262fa89440be17122421d7f1fac7feb8 (diff) |
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>
Diffstat (limited to 'doc/api/http.md')
-rw-r--r-- | doc/api/http.md | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/doc/api/http.md b/doc/api/http.md index 4ceebe16c3f..f9091859054 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -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}`); |