Skip to content

Commit 22cc9f6

Browse files
committed
Lower the header names before sorting them
1 parent 9cac233 commit 22cc9f6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

duo_client/client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,17 @@ def canon_x_duo_headers(additional_headers):
6565
if additional_headers is None:
6666
additional_headers = {}
6767

68+
# Lower the headers before sorting them
69+
lowered_headers = {}
70+
for header_name, header_value in additional_headers.items():
71+
header_name = header_name.lower() if header_name is not None else None
72+
lowered_headers[header_name] = header_value
73+
6874
canon_list = []
6975
added_headers = [] # store headers we've added, use for duplicate checking (case insensitive)
70-
for header_name in sorted(additional_headers.keys()):
76+
for header_name in sorted(lowered_headers.keys()):
7177
# Extract header value and set key to lower case from now on.
72-
value = additional_headers[header_name]
73-
header_name = header_name.lower() if header_name is not None else None
78+
value = lowered_headers[header_name]
7479

7580
# Validation gate. We will raise if a problem is found here.
7681
_validate_additional_header(header_name, value, added_headers)

0 commit comments

Comments
 (0)