Describe the bug
Raw byte data provided with data= to requests.post has header application/x-www-form-urlencoded. This is not desireable as some servers will refuse a request with that header
To Reproduce
from curl_cffi import requests
resp = requests.post('https://httpbin.org/anything', data=b'test')
print(resp.json()['headers']['Content-Type'])
Expected behavior
Should be application/octet-stream unless specified otherwise.
Describe the bug Raw byte data provided with
data=
torequests.post
has headerapplication/x-www-form-urlencoded
. This is not desireable as some servers will refuse a request with that headerTo Reproduce
Expected behavior Should be
application/octet-stream
unless specified otherwise.Requests only applies this header to types other than str and bytes (e.g. dict). https://github.com/psf/requests/blob/f12ccbef6d6b95564da8d22e280d28c39d53f0e9/src/requests/models.py#L552-L562
Versions
Additional context
https://github.com/lexiforest/curl_cffi/blob/8e69ad74f6fbff2a58148f0712c8f2247517e366/curl_cffi/requests/session.py#L450-L454C64