http: fixup options.method error message

Use `options.method` instead of just `method`

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

PR-URL: https://github.com/nodejs/node/pull/32471
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
James M Snell 2020-03-24 14:32:37 -07:00 committed by Anna Henningsen
parent 8e00f0d2a2
commit 567b352062
No known key found for this signature in database
GPG Key ID: A94130F0BFC8EBE9
3 changed files with 4 additions and 4 deletions

View File

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

View File

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

View File

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