From 59bf96068d09faf8a6422150ddac986f708d73af 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 --- 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 3f335aa6eaa7ce..d5534f69710315 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -172,7 +172,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) { @@ -193,7 +193,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 3f9c98e8380363..d39c2b781adc7c 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -339,7 +339,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) }); });