From 7b5589653a1ca93ad9caa2beabafec8f77b7cc3b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 8 Sep 2025 08:43:32 -0300 Subject: [PATCH] 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. --- src/config/settings.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/config/settings.py b/src/config/settings.py index f2e3be7e..8b5aaa4f 100644 --- a/src/config/settings.py +++ b/src/config/settings.py @@ -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(