| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 212263a commit cd857a9
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -78,6 +78,7 @@ const { | |||
| 78 | 78 | const { | |
| 79 | 79 | validateInteger, | |
| 80 | 80 | validateBoolean, | |
| 81 | + validateString, | ||
| 81 | 82 | } = require('internal/validators'); | |
| 82 | 83 | const { getTimerDuration } = require('internal/timers'); | |
| 83 | 84 | const { | |
@@ -218,12 +219,11 @@ function ClientRequest(input, options, cb) { | |||
| 218 | 219 | delete optsWithoutSignal.signal; | |
| 219 | 220 | } | |
| 220 | 221 | let method = options.method; | |
| 221 | - const methodIsString = (typeof method === 'string'); | ||
| 222 | - if (method !== null && method !== undefined && !methodIsString) { | ||
| 223 | - throw new ERR_INVALID_ARG_TYPE('options.method', 'string', method); | ||
| 222 | + if (method != null) { | ||
| 223 | + validateString(method, 'options.method'); | ||
| 224 | 224 | } | |
| 225 | 225 | ||
| 226 | - if (methodIsString && method) { | ||
| 226 | + if (method) { | ||
| 227 | 227 | if (!checkIsHttpToken(method)) { | |
| 228 | 228 | throw new ERR_INVALID_HTTP_TOKEN('Method', method); | |
| 229 | 229 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments