Properties

$headers

$headers : array

List of all HTTP request headers.

Type

array

$headerMap

$headerMap : array

Holds a map of lower-case header names and their normal-case key as it is in $headers.

Used for case-insensitive header access.

Type

array

$protocolVersion

$protocolVersion : string

Protocol version

Type

string

$validProtocolVersions

$validProtocolVersions : array

List of valid protocol versions

Type

array

$body

$body : string

Message body

Type

string

Methods

getBody()

getBody() : mixed

Returns the Message's body.

Returns

mixed

populateHeaders()

populateHeaders() 

Populates the $headers array with any headers the getServer knows about.

getHeaders()

getHeaders() : array

Returns an array containing all headers.

Returns

array —

An array of the request headers

getHeader()

getHeader(string  $name) : array|\CodeIgniter\HTTP\Header

Returns a single header object. If multiple headers with the same name exist, then will return an array of header objects.

Parameters

string $name

Returns

array|\CodeIgniter\HTTP\Header

hasHeader()

hasHeader(string  $name) : boolean

Determines whether a header exists.

Parameters

string $name

Returns

boolean

getHeaderLine()

getHeaderLine(string  $name) : string

Retrieves a comma-separated string of the values for a single header.

This method returns all of the header values of the given case-insensitive header name as a string concatenated together using a comma.

NOTE: Not all header values may be appropriately represented using comma concatenation. For such headers, use getHeader() instead and supply your own delimiter when concatenating.

Parameters

string $name

Returns

string

setHeader()

setHeader(string  $name, array|null|string  $value) : \CodeIgniter\HTTP\Message|\CodeIgniter\HTTP\Response

Sets a header and it's value.

Parameters

string $name
array|null|string $value

Returns

\CodeIgniter\HTTP\Message|\CodeIgniter\HTTP\Response

removeHeader()

removeHeader(string  $name) : \CodeIgniter\HTTP\Message

Removes a header from the list of headers we track.

Parameters

string $name

Returns

\CodeIgniter\HTTP\Message

appendHeader()

appendHeader(string  $name, string  $value) : \CodeIgniter\HTTP\Message

Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess)

Parameters

string $name
string $value

Returns

\CodeIgniter\HTTP\Message

prependHeader()

prependHeader(string  $name, string  $value) : \CodeIgniter\HTTP\Message

Adds an additional header value to any headers that accept multiple values (i.e. are an array or implement ArrayAccess)

Parameters

string $name
string $value

Returns

\CodeIgniter\HTTP\Message

getProtocolVersion()

getProtocolVersion() : string

Returns the HTTP Protocol Version.

Returns

string

setProtocolVersion()

setProtocolVersion(string  $version) : \CodeIgniter\HTTP\Message

Sets the HTTP protocol version.

Parameters

string $version

Returns

\CodeIgniter\HTTP\Message

getHeaderName()

getHeaderName(string  $name) : string

Takes a header name in any case, and returns the normal-case version of the header.

Parameters

string $name

Returns

string