Response compression
emanueletoffolon opened this issue · comments
Hi everyone.
Is there a possibility to set response compression?
I tried modifying the Meilisearch\Http\Client class by adding the following line in the constructor
$this->headers['Accept-Encoding'] = 'gzip';
and it seems to work fine, but I haven't found anywhere the possibility to add this header to the http client without having to change the source.
Thanks in advance and sorry if I didn't write in perfect English
The client let's you pass in a custom HttpClient to achieve the desired behavior for now.
meilisearch-php/src/Client.php
Line 41 in c5343cc
Maybe @brunoocasali has an opinion on this to make it a option to active it by default
You're right @mmachatschek that's the way I know that this could be achieved.
If you have any issues while you try to create your own httpClient you can send a message in the discord you can get help from the community there! https://discord.gg/meilisearch
In case others find this issue, compression can easily be enabled like this:
$client = new \GuzzleHttp\Client([
'decode_content' => 'br', // gzip, deflate
]);
return new \Meilisearch\Client($host, $key, $client);