# new ClientRequest (o: Object)
Arguments:
o
: Object
Methods
# end () → IncomingMessage instance
End request by writing a last chunk of data (optional) and send request to server. See UBWriter#write for parameters
# getHeader (name: String) → String instance
Reads out a header that's already been queued but not sent to the client.
Arguments:
name
: String
# removeHeader (name: String) instance
Removes a header that's queued for implicit sending
Arguments:
name
: String
# setHeader (name: String, value: String) instance
Sets a single header value for implicit headers. If this header already exists in the to-be-sent headers, its value will be replaced. Use an array of strings here if you need to send multiple headers with the same name
request.setHeader('Content-Type', 'text/html');
request.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']);
# setHeadersAsString (allHeaders: String) instance
Set all headers delimited by CRLF by once
Arguments:
allHeaders
: String
# setMethod (method: String) instance
Set new HTTP method for request. Usually used during several request to the same server to avoid socket recreation.
Arguments:
method
: String
# setPath (path: String) instance
Set new path for request. Usually used during several request to the same server to avoid socket recreation.
Arguments:
path
: StringNew path. Should include query string if any. E.G. '/index.html?page=12'
# write (data: ArrayBuffer | Object | String, encodingopt: String) instance
Write to source.
Arguments:
data
: ArrayBuffer| Object| StringData to write. If Object - it stringify before write
encoding
: StringEncode data to
encoding
before write. Default toutf-8
in case data is String orbin
in case data is ArrayBuffer. One of "utf-8"|"ucs2"|"bin"|"base64"|"base64toBin".base64toBin
applicable only if data is Buffer alike