@@ -80,6 +80,7 @@ const {
|
80 | 80 | const { |
81 | 81 | validateInteger, |
82 | 82 | validateBoolean, |
| 83 | + validateString, |
83 | 84 | } = require('internal/validators'); |
84 | 85 | const { getTimerDuration } = require('internal/timers'); |
85 | 86 | const { |
@@ -270,12 +271,11 @@ function ClientRequest(input, options, cb) {
|
270 | 271 | delete optsWithoutSignal.signal; |
271 | 272 | } |
272 | 273 | let method = options.method; |
273 | | -const methodIsString = (typeof method === 'string'); |
274 | | -if (method !== null && method !== undefined && !methodIsString) { |
275 | | -throw new ERR_INVALID_ARG_TYPE('options.method', 'string', method); |
| 274 | +if (method != null) { |
| 275 | +validateString(method, 'options.method'); |
276 | 276 | } |
277 | 277 | |
278 | | -if (methodIsString && method) { |
| 278 | +if (method) { |
279 | 279 | if (!checkIsHttpToken(method)) { |
280 | 280 | throw new ERR_INVALID_HTTP_TOKEN('Method', method); |
281 | 281 | } |
|