Skip to content

Commit 4a9690f

Browse files
committed
Add unsigned headers
1 parent a6c0e33 commit 4a9690f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

app/grandchallenge/cases/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@ def dicom(self, request, pk=None):
190190
{
191191
"image_set_id": image.dicom_image_set.image_set_id,
192192
"get_image_set_metadata": serialize_aws_request(
193-
metadata_request
193+
request=metadata_request,
194+
unsigned_headers={
195+
"Accept-Encoding": "gzip", # Cannot be signed because a browser can modify this outside of our control
196+
},
194197
),
195198
"image_frames": serialized_image_frames,
196199
}

app/grandchallenge/components/backends/base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,21 @@ def duration_to_millicents(*, duration, usd_cents_per_hour):
8989
)
9090

9191

92-
def serialize_aws_request(request):
92+
def serialize_aws_request(request, *, unsigned_headers=None):
9393
"""
9494
The kwargs that will be passed to httpx.stream or httpx.request
9595
to generate a response from an AWSRequest instance.
9696
9797
External clients use this so the kwargs should not be changed.
9898
"""
99+
headers = dict(request.headers.items())
100+
if unsigned_headers:
101+
headers.update(unsigned_headers)
99102
return {
100103
"url": request.url,
101104
"method": request.method,
102105
"data": request.data,
103-
"headers": dict(request.headers.items()),
106+
"headers": headers,
104107
}
105108

106109

0 commit comments

Comments
 (0)