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

Breadcrumb

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

function Proxy::wrapSync

Sends synchronous requests to a specific handler while sending all other requests to another handler.

Parameters

callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for normal responses:

callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $sync Handler used for synchronous responses.:

Return value

callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface Returns the composed handler.

1 call to Proxy::wrapSync()
Utils::chooseHandler in vendor/guzzlehttp/guzzle/src/Utils.php
Chooses and creates a default handler to use based on the environment.

File

vendor/guzzlehttp/guzzle/src/Handler/Proxy.php, line 25

Class

Proxy
Provides basic proxies for handlers.

Namespace

GuzzleHttp\Handler

Code

public static function wrapSync(callable $default, callable $sync) : callable {
    return static function (RequestInterface $request, array $options) use ($default, $sync) : PromiseInterface {
        return empty($options[RequestOptions::SYNCHRONOUS]) ? $default($request, $options) : $sync($request, $options);
    };
}

API Navigation

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