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.

withoutHeader(string $name)

Remove a header from the request.

withoutHeaders(array $names)

Remove the given headers from 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 withoutHeader(string $name)

Remove a header from the request.

Parameters

string $name

Return Value

HasHeaders

at line 108
HasHeaders withoutHeaders(array $names)

Remove the given headers from the request.

Parameters

array $names

Return Value

HasHeaders

at line 126
HasHeaders contentType(string $contentType)

Specify the request content type.

Parameters

string $contentType

Return Value

HasHeaders

at line 136
HasHeaders acceptJson()

Indicate that JSON should be returned by the server.

Return Value

HasHeaders

at line 146
HasHeaders accept(string $contentType)

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

Parameters

string $contentType

Return Value

HasHeaders

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

Specify the request user agent.

Parameters

bool|string $userAgent

Return Value

HasHeaders

at line 166
protected array defaultHeaders()

Resolve the default request headers.

Return Value

array

at line 174
protected ArrayRepository headerRepository()

Get the request header repository.

Return Value

ArrayRepository