Skip to content

Commit

Permalink
Fix Django header handling in wsgi implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mrrooijen committed Jul 25, 2024
1 parent a42e92a commit 77b33e7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions hirefire_resource/middleware/wsgi/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ 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"),
token=req.META.get("HTTP_HIREFIRE_TOKEN"),
)
)

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)

0 comments on commit 77b33e7

Please sign in to comment.