You are here

private function Client::transfer in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/guzzle/src/Client.php \GuzzleHttp\Client::transfer()

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 250

Class

Client
@method ResponseInterface get($uri, array $options = []) @method ResponseInterface head($uri, array $options = []) @method ResponseInterface put($uri, array $options = []) @method ResponseInterface post($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_error
  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);
  }
}