Add handling for Content-Type header in AppClients

This commit modifies the AppClients class to remove the Content-Type header if it is explicitly set to None, particularly for file uploads. This change enhances the robustness of the async code by ensuring proper header management during API requests, aligning with the project's focus on well-documented and maintainable code.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2025-09-08 08:43:32 -03:00
parent 2543b2103b
commit 7b5589653a

View file

@ -322,6 +322,10 @@ class AppClients:
existing_headers = kwargs.pop("headers", {})
headers = {**default_headers, **existing_headers}
# Remove Content-Type if explicitly set to None (for file uploads)
if headers.get("Content-Type") is None:
headers.pop("Content-Type", None)
url = f"{LANGFLOW_URL}{endpoint}"
return await self.langflow_http_client.request(