Only use .content for POST (#2981)

Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
Joakim Sørensen 2021-06-29 11:29:47 +02:00 committed by GitHub
parent 223f5b7bb1
commit 07eeb2eaf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,13 +164,18 @@ class APIIngress(CoreSysAttributes):
url = self._create_url(addon, path)
source_header = _init_header(request, addon)
# Passing the raw stream breaks requests for some webservers
# since we just need it for POST requests really, for all other methods
# we read the bytes and pass that to the request to the add-on
data = request.content if request.method == "POST" else await request.read()
async with self.sys_websession.request(
request.method,
url,
headers=source_header,
params=request.query,
allow_redirects=False,
data=request.content,
data=data,
timeout=ClientTimeout(total=None),
) as result:
headers = _response_header(result)