AddHostPlugin
in package
implements
Plugin
FinalYes
Add schema, host and port to a request. Can be set to overwrite the schema and host if desired.
Tags
Table of Contents
Interfaces
- Plugin
- A plugin is a middleware to transform the request and/or the response.
Properties
- $host : UriInterface
- $replace : bool
Methods
- __construct() : mixed
- handleRequest() : Promise
- Handle the request and return the response coming from the next callable.
- configureOptions() : void
Properties
$host
private
UriInterface
$host
$replace
private
bool
$replace
Methods
__construct()
public
__construct(UriInterface $host[, array{'replace'?: bool} $config = [] ]) : mixed
Parameters
- $host : UriInterface
- $config : array{'replace'?: bool} = []
-
Configuration options:
- replace: True will replace all hosts, false will only add host when none is specified
handleRequest()
Handle the request and return the response coming from the next callable.
public
handleRequest(RequestInterface $request, callable $next, callable $first) : Promise
Parameters
- $request : RequestInterface
- $next : callable
-
Next middleware in the chain, the request is passed as the first argument
- $first : callable
-
First middleware in the chain, used to to restart a request
Return values
Promise —Resolves a PSR-7 Response or fails with an Http\Client\Exception (The same as HttpAsyncClient)
configureOptions()
private
configureOptions(OptionsResolver $resolver) : void
Parameters
- $resolver : OptionsResolver