vespa-engine / pyvespa

Python API for https://vespa.ai, the open big data serving engine
https://pyvespa.readthedocs.io/
Apache License 2.0
95 stars 30 forks source link

Add integration test to test for accept-encoding: gzip #883

Closed thomasht86 closed 1 month ago

thomasht86 commented 1 month ago

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

Ref #872.

It turns out both requests and httpx adds a default header with Accept-Encoding: gzip, deflate. The Vespa container also replies with content-encoding: gzip

The behavior can be verified with

import requests
import httpx

# Using requests
requests_response = requests.get('https://httpbin.org')
print("Requests - Accept-Encoding header:", requests_response.request.headers.get('Accept-Encoding'))

# Using httpx
httpx_response = httpx.get('https://httpbin.org')
print("HTTPX - Accept-Encoding header:", httpx_response.request.headers.get('Accept-Encoding'))

They will also be decompressed automatically. See:

This PR adds integration tests to test for this.

jobergum commented 1 month ago

Thanks for investigating this