You are here

public static function Proxy::wrapStreaming in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/guzzle/src/Handler/Proxy.php \GuzzleHttp\Handler\Proxy::wrapStreaming()

Sends streaming requests to a streaming compatible handler while sending all other requests to a default handler.

This, for example, could be useful for taking advantage of the performance benefits of curl while still supporting true streaming through the StreamHandler.

Parameters

callable $default Handler used for non-streaming responses:

callable $streaming Handler used for streaming responses:

Return value

callable Returns the composed handler.

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

File

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

Class

Proxy
Provides basic proxies for handlers.

Namespace

GuzzleHttp\Handler

Code

public static function wrapStreaming(callable $default, callable $streaming) {
  return function (RequestInterface $request, array $options) use ($default, $streaming) {
    return empty($options['stream']) ? $default($request, $options) : $streaming($request, $options);
  };
}