trait HasHeaders

Properties

protected ArrayRepository|null $headerRepository

The request headers.

Methods

array
headers()

Get the request headers.

bool
hasHeader(string $name)

Determine if the request contains the given header.

withHeaders(array $headers)

Add headers to the request.

withHeader(string $name, mixed $value)

Add a header to the request.

replaceHeaders(array $headers)

Replace matching headers on the request.

contentType(string $contentType)

Specify the request content type.

acceptJson()

Indicate that JSON should be returned by the server.

accept(string $contentType)

Indicate the type of content that should be returned by the server.

withUserAgent(bool|string $userAgent)

Specify the request user agent.

array
defaultHeaders()

Resolve the default request headers.

headerRepository()

Get the request header repository.

Details

at line 21
array headers()

Get the request headers.

Return Value

array

at line 29
bool hasHeader(string $name)

Determine if the request contains the given header.

Parameters

string $name

Return Value

bool

at line 46
HasHeaders withHeaders(array $headers)

Add headers to the request.

Parameters

array $headers

Return Value

HasHeaders

at line 58
HasHeaders withHeader(string $name, mixed $value)

Add a header to the request.

Parameters

string $name
mixed $value

Return Value

HasHeaders

at line 69
HasHeaders replaceHeaders(array $headers)

Replace matching headers on the request.

Parameters

array $headers

Return Value

HasHeaders

at line 97
HasHeaders contentType(string $contentType)

Specify the request content type.

Parameters

string $contentType

Return Value

HasHeaders

at line 107
HasHeaders acceptJson()

Indicate that JSON should be returned by the server.

Return Value

HasHeaders

at line 117
HasHeaders accept(string $contentType)

Indicate the type of content that should be returned by the server.

Parameters

string $contentType

Return Value

HasHeaders

at line 127
HasHeaders withUserAgent(bool|string $userAgent)

Specify the request user agent.

Parameters

bool|string $userAgent

Return Value

HasHeaders

at line 137
protected array defaultHeaders()

Resolve the default request headers.

Return Value

array

at line 145
protected ArrayRepository headerRepository()

Get the request header repository.

Return Value

ArrayRepository