trait MakesHttpRequests (View source)

Properties

protected array $defaultHeaders

Additional headers for the request.

protected array $defaultCookies

Additional cookies for the request.

protected array $unencryptedCookies

Additional cookies will not be encrypted for the request.

protected array $serverVariables

Additional server variables for the request.

protected bool $followRedirects

Indicates whether redirects should be followed.

protected bool $encryptCookies

Indicates whether cookies should be encrypted.

protected bool $withCredentials

Indicated whether JSON requests should be performed "with credentials" (cookies).

Methods

$this
withHeaders(array $headers)

Define additional headers to be sent with the request.

$this
withHeader(string $name, string $value)

Add a header to be sent with the request.

$this
withToken(string $token, string $type = 'Bearer')

Add an authorization token for the request.

$this
flushHeaders()

Flush all the configured headers.

$this
withServerVariables(array $server)

Define a set of server variables to be sent with the requests.

$this
withoutMiddleware(string|array|null $middleware = null)

Disable middleware for the test.

handle($request, $next)

No description

Details

$this withHeaders(array $headers)

Define additional headers to be sent with the request.

Parameters

array $headers

Return Value

$this

$this withHeader(string $name, string $value)

Add a header to be sent with the request.

Parameters

string $name
string $value

Return Value

$this

$this withToken(string $token, string $type = 'Bearer')

Add an authorization token for the request.

Parameters

string $token
string $type

Return Value

$this

$this flushHeaders()

Flush all the configured headers.

Return Value

$this

$this withServerVariables(array $server)

Define a set of server variables to be sent with the requests.

Parameters

array $server

Return Value

$this

$this withoutMiddleware(string|array|null $middleware = null)

Disable middleware for the test.

Parameters

string|array|null $middleware

Return Value

$this

handle($request, $next)

No description

Parameters

$request
$next