From 52a52d26647df876c9e904812b781671ef5785b1 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 24 Mar 2020 14:32:37 -0700 Subject: [PATCH] http: fixup options.method error message Use `options.method` instead of just `method` Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/32471 Reviewed-By: Evan Lucas Reviewed-By: Trivikram Kamat --- lib/_http_client.js | 4 ++-- lib/_http_server.js | 2 +- test/parallel/test-http-client-check-http-token.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index 2d2e4eeed21915..e5b35bf0ca9162 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -169,7 +169,7 @@ function ClientRequest(input, options, cb) { let method = options.method; const methodIsString = (typeof method === 'string'); if (method !== null && method !== undefined && !methodIsString) { - throw new ERR_INVALID_ARG_TYPE('method', 'string', method); + throw new ERR_INVALID_ARG_TYPE('options.method', 'string', method); } if (methodIsString && method) { @@ -185,7 +185,7 @@ function ClientRequest(input, options, cb) { if (insecureHTTPParser !== undefined && typeof insecureHTTPParser !== 'boolean') { throw new ERR_INVALID_ARG_TYPE( - 'insecureHTTPParser', 'boolean', insecureHTTPParser); + 'options.insecureHTTPParser', 'boolean', insecureHTTPParser); } this.insecureHTTPParser = insecureHTTPParser; diff --git a/lib/_http_server.js b/lib/_http_server.js index 9a7d23844cb535..02fa95e304b247 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -336,7 +336,7 @@ function Server(options, requestListener) { if (insecureHTTPParser !== undefined && typeof insecureHTTPParser !== 'boolean') { throw new ERR_INVALID_ARG_TYPE( - 'insecureHTTPParser', 'boolean', insecureHTTPParser); + 'options.insecureHTTPParser', 'boolean', insecureHTTPParser); } this.insecureHTTPParser = insecureHTTPParser; diff --git a/test/parallel/test-http-client-check-http-token.js b/test/parallel/test-http-client-check-http-token.js index d09fbe1b8ee959..ef2445ec66e520 100644 --- a/test/parallel/test-http-client-check-http-token.js +++ b/test/parallel/test-http-client-check-http-token.js @@ -23,7 +23,7 @@ server.listen(0, common.mustCall(() => { }, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', - message: 'The "method" argument must be of type string.' + + message: 'The "options.method" property must be of type string.' + common.invalidArgTypeHelper(method) }); });