Add insecureHTTPParser Parameter (#856)

Keep whitespace consistent
This commit is contained in:
Christian Kruse 2020-06-04 08:54:02 -07:00 committed by GitHub
parent 69d25b904a
commit af7e67f504
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -446,7 +446,8 @@ The default values are shown after each option key.
compress: true, // support gzip/deflate content encoding. false to disable
size: 0, // maximum response body size in bytes. 0 to disable
agent: null, // http(s).Agent instance or function that returns an instance (see below)
highWaterMark: 16384 // the maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource.
highWaterMark: 16384, // the maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource.
insecureHTTPParser: false // Use an insecure HTTP parser that accepts invalid HTTP headers when `true`.
}
```
@ -537,6 +538,11 @@ const fetch = require('node-fetch');
})();
```
#### Insecure HTTP Parser
Passed through to the `insecureHTTPParser` option on http(s).request. See [`http.request`](https://nodejs.org/api/http.html#http_http_request_url_options_callback) for more information.
<a id="class-request"></a>
### Class: Request

View File

@ -100,6 +100,7 @@ export default class Request extends Body {
this.counter = init.counter || input.counter || 0;
this.agent = init.agent || input.agent;
this.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;
this.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;
}
get method() {
@ -214,6 +215,7 @@ export const getNodeRequestOptions = request => {
href: parsedURL.href,
method: request.method,
headers: headers[Symbol.for('nodejs.util.inspect.custom')](),
insecureHTTPParser: request.insecureHTTPParser,
agent
};