Skip to content

Commit 52a52d2

Browse files
jasnelltargos
authored andcommittedApr 22, 2020
http: fixup options.method error message
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>
1 parent 7c0c4e9 commit 52a52d2

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

175175
if (methodIsString && method) {
@@ -185,7 +185,7 @@ function ClientRequest(input, options, cb) {
185185
if (insecureHTTPParser !== undefined &&
186186
typeof insecureHTTPParser !== 'boolean') {
187187
throw new ERR_INVALID_ARG_TYPE(
188-
'insecureHTTPParser', 'boolean', insecureHTTPParser);
188+
'options.insecureHTTPParser', 'boolean', insecureHTTPParser);
189189
}
190190
this.insecureHTTPParser = insecureHTTPParser;
191191

‎lib/_http_server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ function Server(options, requestListener) {
336336
if (insecureHTTPParser !== undefined &&
337337
typeof insecureHTTPParser !== 'boolean') {
338338
throw new ERR_INVALID_ARG_TYPE(
339-
'insecureHTTPParser', 'boolean', insecureHTTPParser);
339+
'options.insecureHTTPParser', 'boolean', insecureHTTPParser);
340340
}
341341
this.insecureHTTPParser = insecureHTTPParser;
342342

‎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)
Please sign in to comment.