Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Middleware.php

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

GuzzleHttp

Code

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);
        };
    };
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal