Problem
We are currently setting some default headers for each request made using the BaseService.request() method.
Among these defaults, we explicitly set "Content-Type": "application/json". This forces the header to always be application/json, regardless of the actual request payload, overriding httpx’s built-in mechanism for setting the appropriate value.
This causes problems when sending other types of content (e.g., multipart/form-data), since users must manually override the header and troubleshoot unexpected request failures 😅.
Proposed Solution
We could remove the default values for "Content-Type" (and possibly "Accept") here, allowing httpx to determine the correct headers automatically.
However, we need to be cautious: in some parts of the code, JSON is being sent as str(content). In such cases, httpx would default to Content-Type: text/html, which is both incorrect and potentially a security risk.
Before removing the defaults, we should ensure that no such patterns remain in the codebase and that JSON payloads are always passed in a way that httpx can correctly detect (json= or content= with proper serialization).
Problem
We are currently setting some default headers for each request made using the
BaseService.request()method.Among these defaults, we explicitly set
"Content-Type": "application/json". This forces the header to always beapplication/json, regardless of the actual request payload, overriding httpx’s built-in mechanism for setting the appropriate value.This causes problems when sending other types of content (e.g., multipart/form-data), since users must manually override the header and troubleshoot unexpected request failures 😅.
Proposed Solution
We could remove the default values for
"Content-Type"(and possibly"Accept") here, allowing httpx to determine the correct headers automatically.However, we need to be cautious: in some parts of the code, JSON is being sent as str(content). In such cases, httpx would default to
Content-Type: text/html, which is both incorrect and potentially a security risk.Before removing the defaults, we should ensure that no such patterns remain in the codebase and that JSON payloads are always passed in a way that httpx can correctly detect (json= or content= with proper serialization).