Summary
    Associative array of headers to add to the request. Each key is thename of a header, and each value is a string or array of stringsrepresenting the header field values.
    Types
    array
    Defaults
    None
    Constant
    1. $client = new GuzzleHttp\Client(['headers' => ['X-Foo' => 'Bar']]);
    2.  
    3. // Will send a request with the X-Foo header.
    4. $client->request('GET', '/get');
    5.  
    6. // Sets the X-Foo header to "test", which prevents the default header
    7. $client->request('GET', '/get', ['headers' => ['X-Foo' => 'test']]);
    8.  
    9. // Will disable adding in default headers.
    10. $client->request('GET', '/get', ['headers' => null]);
    11.  
    12. // Will not overwrite the X-Foo header because it is in the message.
    13. $request = new Request('GET', 'http://foo.com', ['X-Foo' => 'test']);
    14. $client->send($request);
    15.  
    16. // Will overwrite the X-Foo header with the request option provided in the
    17. // send method.
    18. use GuzzleHttp\Psr7\Request;
    19. $client->send($request, ['headers' => ['X-Foo' => 'overwrite']]);