You are here

protected function LingotekHttp::getDefaultHeaders in Lingotek Translation 3.7.x

Same name and namespace in other branches
  1. 8 src/Remote/LingotekHttp.php \Drupal\lingotek\Remote\LingotekHttp::getDefaultHeaders()
  2. 8.2 src/Remote/LingotekHttp.php \Drupal\lingotek\Remote\LingotekHttp::getDefaultHeaders()
  3. 4.0.x src/Remote/LingotekHttp.php \Drupal\lingotek\Remote\LingotekHttp::getDefaultHeaders()
  4. 3.0.x src/Remote/LingotekHttp.php \Drupal\lingotek\Remote\LingotekHttp::getDefaultHeaders()
  5. 3.1.x src/Remote/LingotekHttp.php \Drupal\lingotek\Remote\LingotekHttp::getDefaultHeaders()
  6. 3.2.x src/Remote/LingotekHttp.php \Drupal\lingotek\Remote\LingotekHttp::getDefaultHeaders()
  7. 3.3.x src/Remote/LingotekHttp.php \Drupal\lingotek\Remote\LingotekHttp::getDefaultHeaders()
  8. 3.4.x src/Remote/LingotekHttp.php \Drupal\lingotek\Remote\LingotekHttp::getDefaultHeaders()
  9. 3.5.x src/Remote/LingotekHttp.php \Drupal\lingotek\Remote\LingotekHttp::getDefaultHeaders()
  10. 3.6.x src/Remote/LingotekHttp.php \Drupal\lingotek\Remote\LingotekHttp::getDefaultHeaders()
  11. 3.8.x src/Remote/LingotekHttp.php \Drupal\lingotek\Remote\LingotekHttp::getDefaultHeaders()

Get the headers that are used in every request.

Return value

string[]

4 calls to LingotekHttp::getDefaultHeaders()
LingotekHttp::delete in src/Remote/LingotekHttp.php
Send a DELETE request.
LingotekHttp::get in src/Remote/LingotekHttp.php
Send a GET request.
LingotekHttp::patch in src/Remote/LingotekHttp.php
Send a PATCH request.
LingotekHttp::post in src/Remote/LingotekHttp.php
Send a POST request.

File

src/Remote/LingotekHttp.php, line 147

Class

LingotekHttp
Lingotek HTTP implementation using Guzzle.

Namespace

Drupal\lingotek\Remote

Code

protected function getDefaultHeaders() {
  $headers = [
    'Accept' => '*/*',
  ];
  if ($token = $this
    ->getCurrentToken()) {
    $headers['Authorization'] = 'bearer ' . $token;
  }
  return $headers;
}