You are here

public static function Middleware::mapRequest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/guzzle/src/Middleware.php \GuzzleHttp\Middleware::mapRequest()

Middleware that applies a map function to the request before passing to the next handler.

Parameters

callable $fn Function that accepts a RequestInterface and returns: a RequestInterface.

Return value

callable

File

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

Class

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

Namespace

GuzzleHttp

Code

public static function mapRequest(callable $fn) {
  return function (callable $handler) use ($fn) {
    return function ($request, array $options) use ($handler, $fn) {
      return $handler($fn($request), $options);
    };
  };
}