HasRequestProperties
trait HasRequestProperties
Traits
Properties
| protected list<array<string, mixed>> | $cookies | The request cookies and their attributes. |
from HasCookies |
| protected IntegerRepository|null | $delayRepository | The request delay. |
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 |
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.
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.
Specify the number of times the request should be attempted.
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 22
HasDelay
delay(int $milliseconds)
Delay the request by the given milliseconds.
in
HasDelay at line 36
int|null
delayMilliseconds()
Get the request delay in milliseconds.
in
HasDelay at line 44
protected int|null
defaultDelay()
Resolve the default request delay.
in
HasDelay at line 52
protected IntegerRepository
delayRepository()
Get the request delay repository.
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
contentType(string $contentType)
Specify the request content type.
in
HasHeaders at line 107
HasHeaders
acceptJson()
Indicate that JSON should be returned by the server.
in
HasHeaders at line 117
HasHeaders
accept(string $contentType)
Indicate the type of content that should be returned by the server.
in
HasHeaders at line 127
HasHeaders
withUserAgent(bool|string $userAgent)
Specify the request user agent.
in
HasHeaders at line 137
protected array
defaultHeaders()
Resolve the default request headers.
in
HasHeaders at line 145
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 46
HasOptions
maxRedirects(int $max)
Specify the maximum number of redirects to allow.
in
HasOptions at line 64
HasOptions
withoutRedirecting()
Indicate that redirects should not be followed.
in
HasOptions at line 74
HasOptions
withoutVerifying()
Indicate that TLS certificates should not be verified.
in
HasOptions at line 85
HasOptions
sink(resource|StreamInterface|string $to)
Specify where the response body should be stored.
in
HasOptions at line 95
HasOptions
timeout(float|int $seconds)
Specify the request timeout in seconds.
in
HasOptions at line 105
HasOptions
connectTimeout(float|int $seconds)
Specify the connection timeout in seconds.
in
HasOptions at line 116
HasOptions
withTelescopeTags(array $tags)
Add Telescope tags to the request.
in
HasOptions at line 126
HasOptions
withoutTelescope()
Disable Telescope recording for the request.
in
HasOptions at line 136
protected array
defaultOptions()
Resolve the default request options.
in
HasOptions at line 144
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 67
protected array
defaultQuery()
Resolve the default request query parameters.
in
HasQuery at line 75
protected string|null
defaultQueryString()
Resolve the default raw query string override.
in
HasQuery at line 83
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
retryPolicy()
Get the request retry policy.