Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Request headers not set in the response #368

Open
IV1T3 opened this issue Aug 11, 2024 · 2 comments
Open

[BUG] Request headers not set in the response #368

IV1T3 opened this issue Aug 11, 2024 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@IV1T3
Copy link

IV1T3 commented Aug 11, 2024

Describe the bug
The request headers are not set in the response object. As shown in the example below, even though request headers were sent, the Headers object is empty in the response.

To Reproduce

>>> from curl_cffi import requests
>>> res = requests.get("https://httpbin.org/headers")
>>> res.json()
{'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate, br, zstd', 'Host': 'httpbin.org', 'X-Amzn-Trace-Id': 'Root=1-66b8ff1e-50969ef8662112f677a6f081'}}
>>> res.request.__dict__
{'url': 'https://httpbin.org/headers', 'headers': Headers({}), 'method': 'GET'}

This also happens using a Session

Expected behavior
I expect the headers to be set.

Versions

  • curl_cffi '0.7.1'
@IV1T3 IV1T3 added the bug Something isn't working label Aug 11, 2024
@perklet
Copy link
Collaborator

perklet commented Aug 12, 2024

Indeed, will fix later. However, avoid using __dict__ if it's not for demostration here.

@lexiforest lexiforest added this to the v0.8 milestone Aug 23, 2024
@lexiforest
Copy link
Owner

Actually, there is no API in libcurl for reading these builtin headers. I will need to patch curl itself to retrieve these values, please expect a longer fix time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants