From 77b33e7ec31023875989122051ea72a57d290a71 Mon Sep 17 00:00:00 2001 From: Michael van Rooijen Date: Thu, 25 Jul 2024 19:36:37 +0800 Subject: [PATCH] Fix Django header handling in wsgi implementation --- hirefire_resource/middleware/wsgi/django.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hirefire_resource/middleware/wsgi/django.py b/hirefire_resource/middleware/wsgi/django.py index a44dfcc..e81309f 100644 --- a/hirefire_resource/middleware/wsgi/django.py +++ b/hirefire_resource/middleware/wsgi/django.py @@ -8,7 +8,7 @@ def __init__(self, get_response): self.get_response = get_response def __call__(self, req): - response = request( + response_data = request( RequestInfo( path=req.path, request_start_time=req.META.get("HTTP_X_REQUEST_START"), @@ -16,9 +16,11 @@ def __call__(self, req): ) ) - if response: - status, headers, body = response - response = HttpResponse(content=body, status=status, headers=headers) + if response_data: + status, headers, body = response_data + response = HttpResponse(content=body, status=status) + for header, value in headers.items(): + response[header] = value return response return self.get_response(req)