You are here

public static function Middleware::mapResponse in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/guzzle/src/Middleware.php \GuzzleHttp\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.

Return value

callable

File

vendor/guzzlehttp/guzzle/src/Middleware.php, line 245

Class

Middleware
Functions used to create and wrap handlers with handler middleware.

Namespace

GuzzleHttp

Code

public static function mapResponse(callable $fn) {
  return function (callable $handler) use ($fn) {
    return function ($request, array $options) use ($handler, $fn) {
      return $handler($request, $options)
        ->then($fn);
    };
  };
}