From 25ac669be9c32e90c49c8a16c17c4d35ec539b11 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 6 Jul 2020 12:33:10 -0700 Subject: [PATCH] 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 Reviewed-By: Trivikram Kamat --- doc/api/http.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/api/http.md b/doc/api/http.md index 550beedb055ce6..d94f791e462833 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -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}`);