Amp\Artax\Request class Request

An HTTP request.

Summary

Properties

Methods

Properties

Methods

__construct — public function __construct(string $uri, string $method = "GET")
No documentation.
Type Parameter Description Default Value
string $uri No documentation. none
string $method No documentation. "GET"
getProtocolVersions — public function getProtocolVersions(): string[]

Retrieve the requests's acceptable HTTP protocol versions.

withProtocolVersions — public function withProtocolVersions(string[] $versions): Amp\Artax\Request

Assign the requests's acceptable HTTP protocol versions.

The HTTP client might choose any of these.

Type Parameter Description Default Value
string[] $versions No documentation. none
getMethod — public function getMethod(): string

Retrieve the request's HTTP method verb.

withMethod — public function withMethod(string $method): Amp\Artax\Request

Specify the request's HTTP method verb.

Type Parameter Description Default Value
string $method No documentation. none
getUri — public function getUri(): string

Retrieve the request's URI.

withUri — public function withUri(string $uri): Amp\Artax\Request

Specify the request's HTTP URI.

Type Parameter Description Default Value
string $uri No documentation. none
hasHeader — public function hasHeader(string $field): bool

Does the message contain the specified header field (case-insensitive)?

Type Parameter Description Default Value
string $field Header name. none
getHeader — public function getHeader(string $field): string|null

Retrieve the first occurrence of the specified header in the message.

If multiple headers exist for the specified field only the value of the first header is returned. Applications may use getHeaderArray() to retrieve a list of all header values received for a given field.

A null return indicates the requested header field was not present.

Type Parameter Description Default Value
string $field Header name. none
getHeaderArray — public function getHeaderArray(string $field): array

Retrieve all occurrences of the specified header in the message.

Applications may use getHeader() to access only the first occurrence.

Type Parameter Description Default Value
string $field Header name. none
withHeader — public function withHeader(string $field, string $value): Amp\Artax\Request

Assign a value for the specified header field by replacing any existing values for that field.

Type Parameter Description Default Value
string $field Header name. none
string $value Header value. none
withAddedHeader — public function withAddedHeader(string $field, string $value): Amp\Artax\Request

Assign a value for the specified header field by adding an additional header line.

Type Parameter Description Default Value
string $field Header name. none
string $value Header value. none
withHeaders — public function withHeaders(array $headers): self
No documentation.
Type Parameter Description Default Value
array $headers No documentation. none
getHeaders — public function getHeaders(bool $originalCase = false): array

Retrieve an associative array of headers matching field names to an array of field values.

Type Parameter Description Default Value
bool $originalCase If true, headers are returned in the case of the last set header with that name. false
withoutHeader — public function withoutHeader(string $field): Amp\Artax\Request

Remove the specified header field from the message.

Type Parameter Description Default Value
string $field Header name. none
getBody — public function getBody(): mixed

Retrieve the message entity body.

withBody — public function withBody(mixed $body): Amp\Artax\Request

Assign the message entity body.

Type Parameter Description Default Value
mixed $body No documentation. none