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