HttpClientResponse

Represents a client-side HTTP response.

Vert.x provides you with one of these via the handler that was provided when creating the @see \io\vertx\jphp\core\http\HttpClientRequest or that was set on the @see \io\vertx\jphp\core\http\HttpClientRequest instance.

It implements @see \io\vertx\jphp\core\streams\ReadStream so it can be used with

see

to pump data with flow control.

package

Default

Methods

__construct

__construct() 

Convenience method for receiving the entire request body in one piece.

bodyHandler( $arg0) : $this

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.

Arguments

$arg0

callable

Response

$this

cookies

cookies() : array

Response

array

the Set-Cookie headers (including trailers)

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.

customFrameHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

endHandler

endHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

exceptionHandler

exceptionHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

fetch

fetch( $arg0) : $this

Arguments

$arg0

integer

Response

$this

Return the first header value with the specified name

getHeader( $arg0) : string

Arguments

$arg0

string

Response

string

the header value

Return the first trailer value with the specified name

getTrailer( $arg0) : string

Arguments

$arg0

string

Response

string

the trailer value

handler

handler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

headers

headers() : \io\vertx\jphp\core\MultiMap

Response

\io\vertx\jphp\core\MultiMap

the headers

Get a net socket for the underlying connection of this request.

netSocket() : \io\vertx\jphp\core\net\NetSocket

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 @see \io\vertx\jphp\core\net\NetSocket after a HTTP CONNECT was issued to the remote peer and it responded with a status code of 200.

Response

\io\vertx\jphp\core\net\NetSocket

the net socket

pause

pause() : $this

Response

$this

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

pipe() : \io\vertx\jphp\core\http\Pipe<Buffer>

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

Response

\io\vertx\jphp\core\http\Pipe

a pipe

Like @see \io\vertx\jphp\core\streams\ReadStream::pipeTo but with no completion handler.

pipeTo( $arg0,  $arg1 = null) : void

param $dst [WriteStream] pipeTo($dst)

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. param $dst [WriteStream] the destination write stream param $handler [callable] pipeTo($dst, $handler)

Arguments

$arg0

WriteStream

$arg1

callable

request

request() : \io\vertx\jphp\core\http\HttpClientRequest

Response

\io\vertx\jphp\core\http\HttpClientRequest

the corresponding request

resume

resume() : $this

Response

$this

statusCode

statusCode() : integer

Response

integer

the status code of the response

statusMessage

statusMessage() : string

Response

string

the status message of the response

Set an handler for stream priority changes.

streamPriorityHandler( $arg0) : $this

This is not implemented for HTTP/1.x.

Arguments

$arg0

callable

Response

$this

trailers

trailers() : \io\vertx\jphp\core\MultiMap

Response

\io\vertx\jphp\core\MultiMap

the trailers

version

version() : string

Response

string

the version of the response