ClientRequest
Properties
A boolean
specifying whether the request will use HTTP chunked transfer encoding or not. Defaults to false. The property is readable and writable, however it can be set only before the first write operation as the HTTP headers are not yet put on the wire. Trying to set the chunkedEncoding
property after the first write will throw an error.
Functions
Cancels an ongoing HTTP transaction. If the request has already emitted the close
event, the abort operation will have no effect. Otherwise an ongoing event will emit abort
and close
events. Additionally, if there is an ongoing response object,it will emit the aborted
event.
Sends the last chunk of the request data. Subsequent write or end operations will not be allowed. The finish
event is emitted just after the end operation.
Continues any pending redirection. Can only be called during a 'redirect'
event.
You can use this method in conjunction with POST
requests to get the progress of a file upload or other data transfer.
Removes a previously set extra header name. This method can be called only before first write. Trying to call it after the first write will throw an error.
Adds an extra HTTP header. The header name will be issued as-is without lowercasing. It can be called only before first write. Calling this method after the first write will throw an error. If the passed value is not a string
, its toString()
method will be called to obtain the final value.
callback
is essentially a dummy function introduced in the purpose of keeping similarity with the Node.js API. It is called asynchronously in the next tick after chunk
content have been delivered to the Chromium networking layer. Contrary to the Node.js implementation, it is not guaranteed that chunk
content have been flushed on the wire before callback
is called.