HasRequestProperties
trait HasRequestProperties
Traits
Properties
| protected list<array<string, mixed>> | $cookies | The request cookies and their attributes. |
from HasCookies |
| protected int|null | $delay | The request delay in milliseconds. |
from HasDelay |
| protected ArrayRepository|null | $headerRepository | The request headers. |
from HasHeaders |
| protected MiddlewarePipeline|null | $middlewarePipeline | The request middleware pipeline. |
from HasMiddleware |
| protected ArrayRepository|null | $optionRepository | The request options. |
from HasOptions |
| protected ArrayRepository|null | $queryRepository | The request query parameters. |
from HasQuery |
| protected string|null | $queryString | The already-encoded query string override. |
from HasQuery |
| protected RetryPolicy|null | $retryPolicy | The request retry policy. |
from HasRetryPolicy |
| protected array<array-key, mixed> | $urlParameters | The parameters substituted into URL templates. |
from HasUrlParameters |
Methods
Specify a cookie and its attributes for the request.
Specify cookies that should be included with the request.
Indicate the type of content that should be returned by the server.
Remove the given options from the request.
Indicate that TLS certificates should not be verified.
Specify where the response body should be stored.
Specify the connection timeout in seconds.
Get the raw query string override, without a leading question mark.
Replace the base URL and endpoint query string.
Remove the given query parameters from the request.
Specify the number of times the request should be attempted.
Specify the URL parameters that can be substituted into the request URL.
Details
in
HasCookies at line 25
HasCookies
withCookie(SetCookie $cookie)
Specify a cookie and its attributes for the request.
in
HasCookies at line 46
HasCookies
withCookies(array $cookies, string $domain)
Specify cookies that should be included with the request.
in
HasCookies at line 60
array
cookies()
Get the request cookies and their attributes.
in
HasDelay at line 21
HasDelay
delay(int $milliseconds)
Delay the request by the given milliseconds.
in
HasDelay at line 35
int|null
delayMilliseconds()
Get the request delay in milliseconds.
in
HasDelay at line 43
protected int|null
defaultDelay()
Resolve the default request delay.
in
HasHeaders at line 21
array
headers()
Get the request headers.
in
HasHeaders at line 29
bool
hasHeader(string $name)
Determine if the request contains the given header.
in
HasHeaders at line 46
HasHeaders
withHeaders(array $headers)
Add headers to the request.
in
HasHeaders at line 58
HasHeaders
withHeader(string $name, mixed $value)
Add a header to the request.
in
HasHeaders at line 69
HasHeaders
replaceHeaders(array $headers)
Replace matching headers on the request.
in
HasHeaders at line 97
HasHeaders
withoutHeader(string $name)
Remove a header from the request.
in
HasHeaders at line 108
HasHeaders
withoutHeaders(array $names)
Remove the given headers from the request.
in
HasHeaders at line 126
HasHeaders
contentType(string $contentType)
Specify the request content type.
in
HasHeaders at line 136
HasHeaders
acceptJson()
Indicate that JSON should be returned by the server.
in
HasHeaders at line 146
HasHeaders
accept(string $contentType)
Indicate the type of content that should be returned by the server.
in
HasHeaders at line 156
HasHeaders
withUserAgent(bool|string $userAgent)
Specify the request user agent.
in
HasHeaders at line 166
protected array
defaultHeaders()
Resolve the default request headers.
in
HasHeaders at line 174
protected ArrayRepository
headerRepository()
Get the request header repository.
in
HasMiddleware at line 19
MiddlewarePipeline
middleware()
Get the request middleware pipeline.
in
HasOptions at line 23
array
options()
Get the request options.
in
HasOptions at line 34
HasOptions
withOptions(array $options)
Add options to the request.
in
HasOptions at line 47
HasOptions
withoutOptions(array|string $keys)
Remove the given options from the request.
in
HasOptions at line 59
HasOptions
maxRedirects(int $max)
Specify the maximum number of redirects to allow.
in
HasOptions at line 77
HasOptions
withoutRedirecting()
Indicate that redirects should not be followed.
in
HasOptions at line 87
HasOptions
withoutVerifying()
Indicate that TLS certificates should not be verified.
in
HasOptions at line 98
HasOptions
sink(resource|StreamInterface|string $to)
Specify where the response body should be stored.
in
HasOptions at line 108
HasOptions
timeout(float|int $seconds)
Specify the request timeout in seconds.
in
HasOptions at line 118
HasOptions
connectTimeout(float|int $seconds)
Specify the connection timeout in seconds.
in
HasOptions at line 129
HasOptions
withTelescopeTags(array $tags)
Add Telescope tags to the request.
in
HasOptions at line 139
HasOptions
withoutTelescope()
Disable Telescope recording for the request.
in
HasOptions at line 149
protected array
defaultOptions()
Resolve the default request options.
in
HasOptions at line 157
protected ArrayRepository
optionRepository()
Get the request option repository.
in
HasQuery at line 24
string|null
queryString()
Get the raw query string override, without a leading question mark.
in
HasQuery at line 32
HasQuery
withQueryString(string $query)
Replace the base URL and endpoint query string.
in
HasQuery at line 44
array
queryParameters()
Get the request query parameters.
in
HasQuery at line 55
HasQuery
withQueryParameters(array $parameters)
Add query parameters to the request.
in
HasQuery at line 71
HasQuery
withoutQueryParameters(array|string $keys)
Remove the given query parameters from the request.
Only values added through the query parameter methods are removed. Values embedded in the base URL, endpoint or raw query string are unchanged.
in
HasQuery at line 83
protected array
defaultQuery()
Resolve the default request query parameters.
in
HasQuery at line 91
protected string|null
defaultQueryString()
Resolve the default raw query string override.
in
HasQuery at line 99
protected ArrayRepository
queryRepository()
Get the request query repository.
in
HasRetryPolicy at line 23
HasRetryPolicy
retry(array|int $times, Closure|int $sleepMilliseconds = 0, callable|null $when = null, bool $throw = true)
Specify the number of times the request should be attempted.
in
HasRetryPolicy at line 37
RetryPolicy|null
retryPolicy()
Get the request retry policy.
in
HasRetryPolicy at line 45
protected RetryPolicy|null
defaultRetryPolicy()
Resolve the default retry policy.
in
HasUrlParameters at line 21
array
urlParameters()
Get the parameters substituted into URL templates.
in
HasUrlParameters at line 32
HasUrlParameters
withUrlParameters(array $parameters = [])
Specify the URL parameters that can be substituted into the request URL.