★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/567b352062Nouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files
http: fixup options.method error message
Use `options.method` instead of just `method`

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #32471
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
jasnell authored and addaleax committed Mar 30, 2020
1 parent 8e00f0d commit 567b352062931df47c826bb21e30b5eb20a63deb
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/_http_client.js
  2. +1 −1 lib/_http_server.js
  3. +1 −1 test/parallel/test-http-client-check-http-token.js
@@ -170,7 +170,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) {
@@ -191,7 +191,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;

@@ -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;

@@ -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)
});
});

0 comments on commit 567b352

Please sign in to comment.