Currently the MultiHttpClient can handle headers only when those are passed when calling $client->run() or $client->runMulti(). But there is no way to specify a set of default headers when initialising the client.
In cases when we want to pass some default headers (like telememetry), classes that use MultiHttpClient shouldn't worry about the telemetry as it's the HTTP Client responsibility to handle those. Those headers should be injected by HTTPFactory and MultiHttpClient should respect those.
Definition of done:
$client = MediaWikiServices::getInstance() ->getHttpRequestFactory() ->createMultiClient([ 'headers' => [ 'X-Request-Id' => 'hash' ] ] ); $client->run([ 'method' => 'GET', 'url' => 'http://localhost:8080', 'headers' => ['second' => 'another'] ]);
Should send request to http://localhost:8080 with two headers:
X-Request-Id: hash and second: another.
Additionally - I noticed that when curl is not available, headers are not passed to Guzzle client.