You are here

private function CurlFactory::applyHeaders in Auth0 Single Sign On 8.2

1 call to CurlFactory::applyHeaders()
CurlFactory::create in vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
Creates a cURL handle resource.

File

vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php, line 301

Class

CurlFactory
Creates curl resources from a request

Namespace

GuzzleHttp\Handler

Code

private function applyHeaders(EasyHandle $easy, array &$conf) {
  foreach ($conf['_headers'] as $name => $values) {
    foreach ($values as $value) {
      $value = (string) $value;
      if ($value === '') {

        // cURL requires a special format for empty headers.
        // See https://github.com/guzzle/guzzle/issues/1882 for more details.
        $conf[CURLOPT_HTTPHEADER][] = "{$name};";
      }
      else {
        $conf[CURLOPT_HTTPHEADER][] = "{$name}: {$value}";
      }
    }
  }

  // Remove the Accept header if one was not set
  if (!$easy->request
    ->hasHeader('Accept')) {
    $conf[CURLOPT_HTTPHEADER][] = 'Accept:';
  }
}