Skip to content

Commit

Permalink
Merge pull request #94 from mbande/patch-1
Browse files Browse the repository at this point in the history
remove empty headers from norm_headers
  • Loading branch information
brianmay committed Oct 1, 2018
2 parents 6ba9b1d + c9c8355 commit 4596590
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions revproxy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ def set_response_headers(response, response_headers):

def normalize_request_headers(request):
"""Function used to transform header, replacing 'HTTP\_' to ''
and replace '_' to '-'
and replace '_' to '-' of non empty required headers
:param request: A HttpRequest that will be transformed
:returns: A dictionary with the normalized headers
"""
norm_headers = {}
for header, value in request.META.items():
if required_header(header):
if required_header(header) and value:
norm_header = header.replace('HTTP_', '').title().replace('_', '-')
norm_headers[norm_header] = value

Expand Down

0 comments on commit 4596590

Please sign in to comment.