new HttpClientResponse()
Represents a client-side HTTP response.
- Source:
Methods
bodyHandler(bodyHandler) → {HttpClientResponse}
Convenience method for receiving the entire request body in one piece.
This saves you having to manually set a dataHandler and an endHandler and append the chunks of the body until the whole body received. Don't use this if your request body is large - you could potentially run out of RAM.
Parameters:
Name | Type | Description |
---|---|---|
bodyHandler |
function | This handler will be called after all the body has been received |
- Source:
Returns:
- Type
- HttpClientResponse
cookies() → {Array.<string>}
- Source:
Returns:
-
the Set-Cookie headers (including trailers)
-
- Type
- Array.<string>
customFrameHandler(handler) → {HttpClientResponse}
Set an custom frame handler. The handler will get notified when the http stream receives an custom HTTP/2
frame. HTTP/2 permits extension of the protocol.
Parameters:
Name | Type | Description |
---|---|---|
handler |
function |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- HttpClientResponse
endHandler(endHandler) → {HttpClientResponse}
Parameters:
Name | Type | Description |
---|---|---|
endHandler |
function |
- Source:
Returns:
- Type
- HttpClientResponse
exceptionHandler(handler) → {HttpClientResponse}
Parameters:
Name | Type | Description |
---|---|---|
handler |
function |
- Source:
Returns:
- Type
- HttpClientResponse
getHeader(headerName) → {string}
Return the first header value with the specified name
Parameters:
Name | Type | Description |
---|---|---|
headerName |
string | the header name |
- Source:
Returns:
the header value
- Type
- string
getTrailer(trailerName) → {string}
Return the first trailer value with the specified name
Parameters:
Name | Type | Description |
---|---|---|
trailerName |
string | the trailer name |
- Source:
Returns:
the trailer value
- Type
- string
handler(handler) → {HttpClientResponse}
Parameters:
Name | Type | Description |
---|---|---|
handler |
function |
- Source:
Returns:
- Type
- HttpClientResponse
headers() → {MultiMap}
- Source:
Returns:
-
the headers
-
- Type
- MultiMap
netSocket() → {NetSocket}
Get a net socket for the underlying connection of this request.
USE THIS WITH CAUTION! Writing to the socket directly if you don't know what you're doing can easily break the HTTP protocol
One valid use-case for calling this is to receive the NetSocket after a HTTP CONNECT was issued to the remote peer and it responded with a status code of 200.
- Source:
Returns:
the net socket
- Type
- NetSocket
pause() → {HttpClientResponse}
- Source:
Returns:
- Type
- HttpClientResponse
resume() → {HttpClientResponse}
- Source:
Returns:
- Type
- HttpClientResponse
statusCode() → {number}
- Source:
Returns:
-
the status code of the response
-
- Type
- number
statusMessage() → {string}
- Source:
Returns:
-
the status message of the response
-
- Type
- string
trailers() → {MultiMap}
- Source:
Returns:
-
the trailers
-
- Type
- MultiMap
version() → {Object}
- Source:
Returns:
-
the version of the response
-
- Type
- Object