dcoles/pycurl-requests

FEATURE SUGGEST: Update sessions headers

Slexyy opened this issue ยท 5 comments

I didn't find that if the session is able to update headers like in requests api:
session = requests.Session()

session.headers.update({'x-test': 'true'})

This is the requests documentation for it:
https://requests.readthedocs.io/en/latest/user/advanced/#session-objects

NVM I was a noob

No worries! Glad it worked for you!
(There goes my weekend project ๐Ÿ˜ข)

But there could be a utf-8 encoding for headers is the content-type is application/json like in requests:
https://github.com/psf/requests/blob/main/requests/utils.py#L553

It gave me a lot of headache when I tried to send a base64 encoded header and the backend of the api gave me an error. Like 8-10 hours of work and all I did was .encode('utf-8') the header ๐Ÿ‘

Thanks! I've opened #7 for the utf-8 encoded header issue.