doc: emphasize "timeout" and "request.setTimeout()" difference
This change brings emphasis on the difference between these two ways of setting a socket timeout on an HTTP request:
http.request(url, { timeout: n })
http.request(url).setTimeout(n)
The two are completely different, and the current state of the docs failed to highlight that difference when I was debugging an issue.
- The
timeout
option onhttp.request()
is forwarded to thehttp.Agent
and applies timeout immediately when the socket is created. - The
request.setTimeout()
method is not forwarded to thehttp.Agent
, and applies timeout after the socket has connected.