The http.ClientRequest Object
The ClientRequest
object is created internally when you call http.request()
when building an HTTP client. This object is intended to represent the request while it is in progress to the server. You use the ClientRequest
object to initiate, monitor, and handle the response from the server.
The ClientRequest
object implements a Writable
stream, so it provides all the functionality of a Writable
stream object. For example, you can use the write()
method to write to the ClientRequest
object as well as pipe a Readable
stream into it.
To implement a ClientRequest
object, you use a call to http.request()
, with the following syntax:
http.request(options, callback)
The options
parameter is an ...
Get Node.js, MongoDB, and AngularJS Web Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.