From 9abf38f285b5ef87674149e12a1437713d506c7e Mon Sep 17 00:00:00 2001 From: Sergio Oller Date: Tue, 13 Dec 2022 09:46:10 +0100 Subject: [PATCH] Do not let aiohttp add a Content-Type header (#4038) * Do not let aiohttp add a Content-Type header aiohttp adds a Content-Type header by default, as well as other headers. This may usually be convenient, but it breaks APIs that explicitly ask for no content type header, for instance on post requests with an empty body. Since ingress is proxying the requests from the browser to the add-on, it should avoid modifying them. I only skip this header auto generation because it actually breaks the Adguard add-on. - https://github.com/hassio-addons/addon-adguard-home/issues/359 I haven't tested this yet. * Use headers constant --- supervisor/api/ingress.py | 1 + 1 file changed, 1 insertion(+) diff --git a/supervisor/api/ingress.py b/supervisor/api/ingress.py index 2e13b2b82..a0b340ea7 100644 --- a/supervisor/api/ingress.py +++ b/supervisor/api/ingress.py @@ -182,6 +182,7 @@ class APIIngress(CoreSysAttributes): allow_redirects=False, data=data, timeout=ClientTimeout(total=None), + skip_auto_headers={hdrs.CONTENT_TYPE}, ) as result: headers = _response_header(result)