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 <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 targos committed Apr 22, 2020
1 parent 7c0c4e9 commit 52a52d2
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 @@ -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) {
Expand All @@ -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;

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

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 52a52d2

Please sign in to comment.