Class: HttpClientResponse

vertx-js/http_client_response~ HttpClientResponse

new HttpClientResponse()

Represents a client-side HTTP response.

Source:

Methods

body(handler) → {HttpClientResponse}

Same as HttpClientResponse#body but with an handler called when the operation completes
Parameters:
Name Type Description
handler function
Source:
Returns:
Type
HttpClientResponse

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

fetch(amount) → {HttpClientResponse}

Parameters:
Name Type Description
amount number
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.

HTTP/1.1 pipe-lined requests cannot support net socket upgrade.

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

pipe() → {Pipe}

Pause this stream and return a to transfer the elements of this stream to a destination .

The stream will be resumed when the pipe will be wired to a WriteStream.

Source:
Returns:
a pipe
Type
Pipe

pipeTo(dst, handler)

Pipe this ReadStream to the WriteStream.

Elements emitted by this stream will be written to the write stream until this stream ends or fails.

Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

Parameters:
Name Type Description
dst WriteStream the destination write stream
handler function
Source:

request() → {HttpClientRequest}

Source:
Returns:
the corresponding request
Type
HttpClientRequest

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

streamPriorityHandler(handler) → {HttpClientResponse}

Set an handler for stream priority changes.

This is not implemented for HTTP/1.x.

Parameters:
Name Type Description
handler function the handler to be called when the stream priority changes
Source:
Returns:
Type
HttpClientResponse

trailers() → {MultiMap}

Source:
Returns:
the trailers
Type
MultiMap

version() → {Object}

Source:
Returns:
the version of the response
Type
Object