Skip to content

Commit ca19d55

Browse files
jasnelladdaleax
authored andcommitted
http: fixup options.method error message
Use `options.method` instead of just `method` Signed-off-by: James M Snell <[email protected]> PR-URL: #32471 Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent a057871 commit ca19d55

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/_http_client.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function ClientRequest(input, options, cb) {
172172
let method = options.method;
173173
const methodIsString = (typeof method === 'string');
174174
if (method !== null && method !== undefined && !methodIsString) {
175-
throw new ERR_INVALID_ARG_TYPE('method', 'string', method);
175+
throw new ERR_INVALID_ARG_TYPE('options.method', 'string', method);
176176
}
177177

178178
if (methodIsString && method) {
@@ -193,7 +193,7 @@ function ClientRequest(input, options, cb) {
193193
if (insecureHTTPParser !== undefined &&
194194
typeof insecureHTTPParser !== 'boolean') {
195195
throw new ERR_INVALID_ARG_TYPE(
196-
'insecureHTTPParser', 'boolean', insecureHTTPParser);
196+
'options.insecureHTTPParser', 'boolean', insecureHTTPParser);
197197
}
198198
this.insecureHTTPParser = insecureHTTPParser;
199199

lib/_http_server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ function Server(options, requestListener) {
339339
if (insecureHTTPParser !== undefined &&
340340
typeof insecureHTTPParser !== 'boolean') {
341341
throw new ERR_INVALID_ARG_TYPE(
342-
'insecureHTTPParser', 'boolean', insecureHTTPParser);
342+
'options.insecureHTTPParser', 'boolean', insecureHTTPParser);
343343
}
344344
this.insecureHTTPParser = insecureHTTPParser;
345345

test/parallel/test-http-client-check-http-token.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ server.listen(0, common.mustCall(() => {
2323
}, {
2424
code: 'ERR_INVALID_ARG_TYPE',
2525
name: 'TypeError',
26-
message: 'The "method" argument must be of type string.' +
26+
message: 'The "options.method" property must be of type string.' +
2727
common.invalidArgTypeHelper(method)
2828
});
2929
});

0 commit comments

Comments
 (0)