Skip to content

Commit 567b352

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 8e00f0d commit 567b352

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
@@ -170,7 +170,7 @@ function ClientRequest(input, options, cb) {
170170
let method = options.method;
171171
const methodIsString = (typeof method === 'string');
172172
if (method !== null && method !== undefined && !methodIsString) {
173-
throw new ERR_INVALID_ARG_TYPE('method', 'string', method);
173+
throw new ERR_INVALID_ARG_TYPE('options.method', 'string', method);
174174
}
175175

176176
if (methodIsString && method) {
@@ -191,7 +191,7 @@ function ClientRequest(input, options, cb) {
191191
if (insecureHTTPParser !== undefined &&
192192
typeof insecureHTTPParser !== 'boolean') {
193193
throw new ERR_INVALID_ARG_TYPE(
194-
'insecureHTTPParser', 'boolean', insecureHTTPParser);
194+
'options.insecureHTTPParser', 'boolean', insecureHTTPParser);
195195
}
196196
this.insecureHTTPParser = insecureHTTPParser;
197197

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)