function Middleware::mapResponse
Middleware that applies a map function to the resolved promise's response.
Parameters
callable $fn Function that accepts a ResponseInterface and: returns a ResponseInterface.
File
-
vendor/
guzzlehttp/ guzzle/ src/ Middleware.php, line 260
Class
- Middleware
- Functions used to create and wrap handlers with handler middleware.
Namespace
GuzzleHttpCode
public static function mapResponse(callable $fn) : callable {
return static function (callable $handler) use ($fn) : callable {
return static function (RequestInterface $request, array $options) use ($handler, $fn) {
return $handler($request, $options)->then($fn);
};
};
}