You are here

private function Client::transfer in Lockr 7.3

Transfers the given request and applies request options.

The URI of the request is not modified and the request options are used as-is without merging in default options.

Parameters

RequestInterface $request:

array $options:

Return value

Promise\PromiseInterface

2 calls to Client::transfer()
Client::requestAsync in vendor/guzzlehttp/guzzle/src/Client.php
Create and send an asynchronous HTTP request.
Client::sendAsync in vendor/guzzlehttp/guzzle/src/Client.php
Asynchronously send an HTTP request.

File

vendor/guzzlehttp/guzzle/src/Client.php, line 259

Class

Client
@method ResponseInterface get(string|UriInterface $uri, array $options = []) @method ResponseInterface head(string|UriInterface $uri, array $options = []) @method ResponseInterface put(string|UriInterface $uri, array $options = []) @method…

Namespace

GuzzleHttp

Code

private function transfer(RequestInterface $request, array $options) {

  // save_to -> sink
  if (isset($options['save_to'])) {
    $options['sink'] = $options['save_to'];
    unset($options['save_to']);
  }

  // exceptions -> http_errors
  if (isset($options['exceptions'])) {
    $options['http_errors'] = $options['exceptions'];
    unset($options['exceptions']);
  }
  $request = $this
    ->applyOptions($request, $options);
  $handler = $options['handler'];
  try {
    return Promise\promise_for($handler($request, $options));
  } catch (\Exception $e) {
    return Promise\rejection_for($e);
  }
}