You are here

public static function Drupal::httpClient in Drupal 10

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

Returns the default http client.

Return value

\GuzzleHttp\Client A guzzle http client instance.

12 calls to Drupal::httpClient()
DrupalTest::testHttpClient in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the httpClient() method.
install_check_localization_server in core/includes/install.core.inc
Checks if the localization server can be contacted.
install_retrieve_file in core/includes/install.core.inc
Attempts to get a file using a HTTP request and to store it locally.
StatisticsAdminTest::setUp in core/modules/statistics/tests/src/Functional/StatisticsAdminTest.php
StatisticsReportsTest::testPopularContentBlock in core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php
Tests the "popular content" block.

... See full list

File

core/lib/Drupal.php, line 477

Class

Drupal
Static Service Container wrapper.

Code

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