You are here

public function LingotekHttp::delete in Lingotek Translation 4.0.x

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

Send a DELETE request.

Parameters

string|\Psr\Http\Message\UriInterface $path: URI object or string.

array $args: Request argument to add via query string.

Return value

\Psr\Http\Message\ResponseInterface A response.

Overrides LingotekHttpInterface::delete

File

src/Remote/LingotekHttp.php, line 105

Class

LingotekHttp
Lingotek HTTP implementation using Guzzle.

Namespace

Drupal\lingotek\Remote

Code

public function delete($path, $args = []) {

  // Let the post method masquerade as a DELETE
  $options = [];
  if (count($args)) {
    $options = [
      RequestOptions::QUERY => $args,
    ];
  }
  return $this->httpClient
    ->delete($this
    ->getBaseUrl() . $path, [
    RequestOptions::HEADERS => $this
      ->getDefaultHeaders() + [
      'X-HTTP-Method-Override' => 'DELETE',
    ],
  ] + $options);
}