\Cake\Http\ClientMessage

Base class for other HTTP requests/responses

Defines some common helper methods, constants and properties.

Summary

Methods
Properties
Constants
headers()
cookies()
body()
$headers
STATUS_OK
STATUS_CREATED
STATUS_ACCEPTED
STATUS_NON_AUTHORITATIVE_INFORMATION
STATUS_NO_CONTENT
STATUS_MOVED_PERMANENTLY
STATUS_FOUND
STATUS_SEE_OTHER
STATUS_TEMPORARY_REDIRECT
METHOD_GET
METHOD_POST
METHOD_PUT
METHOD_DELETE
METHOD_PATCH
METHOD_OPTIONS
METHOD_TRACE
METHOD_HEAD
No protected methods found
$_cookies
$_body
N/A
No private methods found
No private properties found
N/A

Constants

STATUS_OK

STATUS_OK = 200 : integer

HTTP 200 code

STATUS_CREATED

STATUS_CREATED = 201 : integer

HTTP 201 code

STATUS_ACCEPTED

STATUS_ACCEPTED = 202 : integer

HTTP 202 code

STATUS_NON_AUTHORITATIVE_INFORMATION

STATUS_NON_AUTHORITATIVE_INFORMATION = 203 : integer

HTTP 203 code

STATUS_NO_CONTENT

STATUS_NO_CONTENT = 204 : integer

HTTP 204 code

STATUS_MOVED_PERMANENTLY

STATUS_MOVED_PERMANENTLY = 301 : integer

HTTP 301 code

STATUS_FOUND

STATUS_FOUND = 302 : integer

HTTP 302 code

STATUS_SEE_OTHER

STATUS_SEE_OTHER = 303 : integer

HTTP 303 code

STATUS_TEMPORARY_REDIRECT

STATUS_TEMPORARY_REDIRECT = 307 : integer

HTTP 307 code

METHOD_GET

METHOD_GET = 'GET' : string

HTTP GET method

METHOD_POST

METHOD_POST = 'POST' : string

HTTP POST method

METHOD_PUT

METHOD_PUT = 'PUT' : string

HTTP PUT method

METHOD_DELETE

METHOD_DELETE = 'DELETE' : string

HTTP DELETE method

METHOD_PATCH

METHOD_PATCH = 'PATCH' : string

HTTP PATCH method

METHOD_OPTIONS

METHOD_OPTIONS = 'OPTIONS' : string

HTTP OPTIONS method

METHOD_TRACE

METHOD_TRACE = 'TRACE' : string

HTTP TRACE method

METHOD_HEAD

METHOD_HEAD = 'HEAD' : string

HTTP HEAD method

Properties

$headers

$headers : array

Type

array

$_cookies

$_cookies : array

The array of cookies in the response.

Type

array

$_body

$_body : string|null

Body for the message.

Type

string|null

Methods

headers()

headers() : array

Get all headers

Returns

array

cookies()

cookies() : array

Get all cookies

Returns

array

body()

body(string|null  $body = null) : mixed

Get/set the body for the message.

Parameters

string|null $body

The body for the request. Leave null for get

Returns

mixed —

Either $this or the body value.