function Drupal::httpClient

Same name and namespace in other branches
  1. 9 core/lib/Drupal.php \Drupal::httpClient()
  2. 8.9.x core/lib/Drupal.php \Drupal::httpClient()
  3. 11.x core/lib/Drupal.php \Drupal::httpClient()

Returns the default http client.

Return value

\GuzzleHttp\Client A guzzle http client instance.

3 calls to Drupal::httpClient()
DrupalTest::testHttpClient in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the httpClient() method.
UserLoginHttpTest::doTestLogin in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Do login testing for a given serialization format.
UserLoginHttpTest::doTestLogoutCsrfProtection in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Tests csrf protection of User Logout route for given serialization format.

File

core/lib/Drupal.php, line 490

Class

Drupal
Static Service Container wrapper.

Code

public static function httpClient() {
  return static::getContainer()->get('http_client');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.