Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
http: Add noDelay to http.request() options.
Add the noDelay option to the http.request() options such that
.setNoDelay() will be called once a socket is obtained.

Add note about noDelay only applying to a TCP socket.
  • Loading branch information
rustyconover committed Feb 26, 2020
commit 844418c544f718949bf3441743d23ab0cc132bb7
3 changes: 3 additions & 0 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -2213,6 +2213,9 @@ changes:
**Default:** 8192 (8KB).
* `method` {string} A string specifying the HTTP request method. **Default:**
`'GET'`.
* `noDelay` {boolean} A boolean with which to call [`socket.setNoDelay()`][]
when a socket connection is established. This only applies when the
underlying connection is a TCP socket.
* `path` {string} Request path. Should include query string if any.
E.G. `'/index.html?page=12'`. An exception is thrown when the request path
contains illegal characters. Currently, only spaces are rejected but that
Expand Down
3 changes: 3 additions & 0 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ function ClientRequest(input, options, cb) {

this.socketPath = options.socketPath;

if (options.noDelay !== undefined)
this._deferToConnect('setNoDelay', [options.noDelay]);

if (options.timeout !== undefined)
this.timeout = getTimerDuration(options.timeout, 'timeout');

Expand Down