Using Guzzle to get a response code from another site in Drupal 8

Key thing as far as timeout vs connection_timeout is that as far as i can tell they are separate and additive; that is, you don’t have to worry about making sure that one value is longer than the other so that it doesn’t short-circuit it.


>>> $client = \Drupal::httpClient();
=> GuzzleHttp\Client {#10681
     +"_serviceId": "http_client",
>>> $request = $client->head('');
=> GuzzleHttp\Psr7\Response {#10713}
>>> $response = $request->send();
PHP Error:  Call to undefined method GuzzleHttp/Psr7/Response::send() in Psy Shell code on line 1
>>> $request->getStatusCode();
=> 200