From 2785627afde3a4ee794984805196487bc294fbb4 Mon Sep 17 00:00:00 2001 From: Lyonnet Date: Tue, 24 Sep 2024 15:43:54 +0800 Subject: [PATCH] Set content-type to application/octet-stream for bytes and strs --- curl_cffi/requests/session.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/curl_cffi/requests/session.py b/curl_cffi/requests/session.py index 2458c6a..2108c5b 100644 --- a/curl_cffi/requests/session.py +++ b/curl_cffi/requests/session.py @@ -452,6 +452,8 @@ def _set_curl_options( _update_header_line(header_lines, "Content-Type", "application/json") if isinstance(data, dict) and method != "POST": _update_header_line(header_lines, "Content-Type", "application/x-www-form-urlencoded") + if isinstance(data, (str, bytes)): + _update_header_line(header_lines, "Content-Type", "application/octet-stream") # Never send `Expect` header. _update_header_line(header_lines, "Expect", "")