HttpResponse

An HTTP response.

The usual HTTP response attributes are available:

  • @see \io\vertx\jphp\ext\web\client\HttpResponse::statusCode the HTTP status code
  • @see \io\vertx\jphp\ext\web\client\HttpResponse::statusMessage the HTTP status message
  • @see \io\vertx\jphp\ext\web\client\HttpResponse::headers the HTTP headers
  • @see \io\vertx\jphp\ext\web\client\HttpResponse::version the HTTP version

The body of the response is returned by @see \io\vertx\jphp\ext\web\client\HttpResponse::body decoded as the format specified by the @see \io\vertx\jphp\ext\web\codec\BodyCodec that built the response.

Keep in mind that using this HttpResponse impose to fully buffer the response body and should be used for payload that can fit in memory.

package

Default

Methods

__construct

__construct() 

body

body() : mixed

Response

mixed

the response body in the format it was decoded.

bodyAsBuffer

bodyAsBuffer() : \io\vertx\jphp\core\buffer\Buffer

Response

\io\vertx\jphp\core\buffer\Buffer

the response body decoded as a {@link Buffer}, or {@code null} if a codec other than {@link BodyCodec#buffer()} was used

bodyAsJson

bodyAsJson( $arg0) : mixed

Arguments

$arg0

string

Response

mixed

the response body decoded as the specified {@code type} with the Jackson mapper, or {@code null} if a codec other than {@link BodyCodec#buffer()} was used

bodyAsJsonArray

bodyAsJsonArray() : array

Response

array

the response body decoded as a {@link JsonArray}, or {@code null} if a codec other than {@link BodyCodec#buffer()} was used

bodyAsJsonObject

bodyAsJsonObject() : array

Response

array

the response body decoded as {@link JsonObject}, or {@code null} if a codec other than {@link BodyCodec#buffer()} was used

<b> bodyAsString() </b>

bodyAsString( $arg0 = null) : string

param $encoding [string] bodyAsString($encoding)

Arguments

$arg0

string

Response

string

the response body decoded as a {@code String}, or {@code null} if a codec other than {@link BodyCodec#buffer()} was used

cookies

cookies() : array

Response

array

the Set-Cookie headers (including trailers)

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

headers

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

Response

\io\vertx\jphp\core\MultiMap

the headers

statusCode

statusCode() : integer

Response

integer

the status code of the response

statusMessage

statusMessage() : string

Response

string

the status message of the response

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