Amp\Artax\DefaultClient class DefaultClient implements Amp\Artax\Client

Standard client implementation.

Use the Client interface for your type declarations so people can use composition to add layers like caching.

Summary

Properties

Methods

Properties

Methods

__construct — public function __construct(string $protocolVersion, int $status, string $reason, array $headers, Amp\ByteStream\InputStream $body, Amp\Artax\Request $request, Amp\Artax\Response $previousResponse = null, Amp\Artax\MetaInfo $metaInfo)
No documentation.
Type Parameter Description Default Value
string $protocolVersion No documentation. none
int $status No documentation. none
string $reason No documentation. none
array $headers No documentation. none
Amp\ByteStream\InputStream $body No documentation. none
Amp\Artax\Request $request No documentation. none
Amp\Artax\Response $previousResponse No documentation. null
Amp\Artax\MetaInfo $metaInfo No documentation. none
request — public function request(Amp\Artax\Request|string $uriOrRequest, array $options = [], Amp\CancellationToken $cancellation = null): Amp\Promise

Asynchronously request an HTTP resource.

Type Parameter Description Default Value
Amp\Artax\Request|string $uriOrRequest An HTTP URI string or a Request instance. none
array $options An array specifying options applicable only for this request. []
Amp\CancellationToken $cancellation A cancellation token to optionally cancel requests. null
read — public function read(): Amp\Promise
No documentation.
__destruct — public function __destruct()
No documentation.
getProtocolVersion — public function getProtocolVersion(): string
No documentation.
getStatus — public function getStatus(): int
No documentation.
getReason — public function getReason(): string
No documentation.
getRequest — public function getRequest(): Amp\Artax\Request
No documentation.
getOriginalRequest — public function getOriginalRequest(): Amp\Artax\Request
No documentation.
getPreviousResponse — public function getPreviousResponse()
No documentation.
hasHeader — public function hasHeader(string $field): bool
No documentation.
Type Parameter Description Default Value
string $field No documentation. none
getHeader — public function getHeader(string $field)
No documentation.
Type Parameter Description Default Value
string $field No documentation. none
getHeaderArray — public function getHeaderArray(string $field): array
No documentation.
Type Parameter Description Default Value
string $field No documentation. none
getHeaders — public function getHeaders(): array
No documentation.
getBody — public function getBody(): Amp\ByteStream\Message
No documentation.
getMetaInfo — public function getMetaInfo(): Amp\Artax\MetaInfo
No documentation.
setOptions — public function setOptions(array $options)

Set multiple options at once.

Type Parameter Description Default Value
array $options An array of the form [OP_CONSTANT => $value] none
setOption — public function setOption(string $option, mixed $value)

Set an option.

Type Parameter Description Default Value
string $option A Client option constant none
mixed $value The option value to assign none