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

Returns the default http client.

Return value

\GuzzleHttp\Client A guzzle http client instance.

13 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
StatisticsLoggingTest::setUp in core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php

... See full list

File

core/lib/Drupal.php, line 497

Class

Drupal
Static Service Container wrapper.

Code

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