Skip to content

Add option for gzip response #2

@nasko-m

Description

@nasko-m

Maybe it will be useful to add gzip compression for response.

I asked WS why some requests like this takes 5 minutes
https://api.wheel-size.com/v1/search/by_model/?make=bmw&model=5-series&year=2007&user_key=

And a part of the answer was:
An easy and convenient way to reduce the bandwidth and response time needed for each request is to enable gzip compression. In order to receive a gzip-encoded response you must do the following thing: Set an Accept-Encoding header:
Accept-Encoding: gzip

So I add in Configuration.php new protected variable and set and get function for it.

protected $acceptEncoding="gzip";

And in SearchApi

if ($this->config->getAcceptEncoding()) {
$defaultHeaders['Accept-Encoding'] = $this->config->getAcceptEncoding();
}

But may be you can add it in other methods and other classes.

Please excuse me if this already exists but i haven't found it

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions