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
This commit is contained in:
Sergio Oller 2022-12-13 09:46:10 +01:00 committed by GitHub
parent 54dfba1faa
commit 9abf38f285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)