MiddlewareInterface
in
Client middleware interface - a PSR-15-style interceptor for Client's outbound dispatch. Not a literal PSR-15 implementation: PSR-15's real interfaces are typed to ServerRequestInterface (server-side only) and cannot apply to a Client's outbound RequestInterface flow, so this mirrors PSR-15's shape with the request type swapped.
Tags
Table of Contents
Methods
- process() : ResponseInterface
- Process the request, optionally passing it (or a modified copy) to $handler to continue the chain, or returning a response directly to short-circuit
Methods
process()
Process the request, optionally passing it (or a modified copy) to $handler to continue the chain, or returning a response directly to short-circuit
public
process(RequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Typed to the broader PSR-7 ResponseInterface for interface parity with RequestHandlerInterface::handle(), but for use with Pop\Http\Client, the response returned here (whether from $handler->handle() or a short-circuit) must be a Pop\Http\Client\Response (or something that satisfies it) - Client\Response is the concrete type this pipeline's terminal handler and Client's internals require, not an arbitrary ResponseInterface. Client enforces this at the end of the pipeline and throws a Client\Exception with a clear message if it's violated.
Parameters
- $request : RequestInterface
- $handler : RequestHandlerInterface