Skip to content

Commit

Permalink
http: fixup options.method error message
Browse files Browse the repository at this point in the history
Use `options.method` instead of just `method`

Signed-off-by: James M Snell <[email protected]>

PR-URL: nodejs#32471
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
jasnell authored and addaleax committed Mar 27, 2020
1 parent a057871 commit ca19d55
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-client-check-http-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});
});
Expand Down

0 comments on commit ca19d55

Please sign in to comment.