protected function Client::prepareRequest

Prepare a request to be sent from the Client by adding client specific behaviors and properties to the request.

Parameters

RequestInterface $request Request to prepare for the client:

Return value

RequestInterface

1 call to Client::prepareRequest()
Client::createRequest in drupal/core/vendor/guzzle/http/Guzzle/Http/Client.php
Create and return a new { Use an absolute path to override the base path of the client, or a relative path to append to the base path of the client. The URI can contain the query string as well. Use an array to provide a URI template and…

File

drupal/core/vendor/guzzle/http/Guzzle/Http/Client.php, line 419

Class

Client
HTTP client

Namespace

Guzzle\Http

Code

protected function prepareRequest(RequestInterface $request) {
  $request
    ->setClient($this);

  // Add any curl options to the request
  if ($options = $this->config
    ->get(self::CURL_OPTIONS)) {
    $request
      ->getCurlOptions()
      ->merge(CurlHandle::parseCurlConfig($options));
  }

  // Add request parameters to the request
  if ($options = $this->config
    ->get(self::REQUEST_PARAMS)) {
    $request
      ->getParams()
      ->merge($options);
  }

  // Attach client observers to the request
  $request
    ->setEventDispatcher(clone $this
    ->getEventDispatcher());
  $this
    ->dispatch('client.create_request', array(
    'client' => $this,
    'request' => $request,
  ));
  return $request;
}