UserAgentMiddleware
in package
Builds and injects the user agent header values.
This middleware must be appended into step where all the metrics to be gathered are already resolved. As of now it should be after the signing step.
Table of Contents
Constants
- AGENT_VERSION = 2.1
Properties
- $metricsFnList : mixed
- $userAgentFnList : mixed
Methods
- __construct() : mixed
- __invoke() : mixed
- When invoked, its injects the user agent header into the request headers.
- wrap() : Closure
- Returns a middleware wrapper function.
Constants
AGENT_VERSION
public
mixed
AGENT_VERSION
= 2.1
Properties
$metricsFnList
public
static mixed
$metricsFnList
= ['appendEndpointMetric', 'appendAccountIdModeMetric', 'appendRetryConfigMetric']
$userAgentFnList
public
static mixed
$userAgentFnList
= ['getSdkVersion', 'getUserAgentVersion', 'getHhvmVersion', 'getOsName', 'getLangVersion', 'getExecEnv', 'getEndpointDiscovery', 'getAppId', 'getMetrics']
Methods
__construct()
public
__construct(callable $nextHandler[, array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $nextHandler : callable
- $args : array<string|int, mixed> = []
__invoke()
When invoked, its injects the user agent header into the request headers.
public
__invoke(CommandInterface $command, RequestInterface $request) : mixed
Parameters
- $command : CommandInterface
- $request : RequestInterface
wrap()
Returns a middleware wrapper function.
public
static wrap(array<string|int, mixed> $args) : Closure
Parameters
- $args : array<string|int, mixed>