File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55from .extract_wsgi_headers import extract_wsgi_headers
66from .build_url_from_wsgi import build_url_from_wsgi
77from ..parse_cookies import parse_cookies
8+ from ...helpers .headers import Headers
89
910
1011@dataclass
1112class WSGIContext :
1213 method : str
13- headers : Dict [ str , List [ str ]]
14+ headers : Headers
1415 cookies : dict
1516 url : str
1617 query : dict
@@ -22,7 +23,7 @@ def parse_wsgi_environ(environ) -> WSGIContext:
2223 This extracts WSGI attributes, described in :
2324 https://peps.python.org/pep-3333/#environ-variables
2425 """
25- headers : Dict [ str , List [ str ]] = extract_wsgi_headers (environ )
26+ headers : Headers = extract_wsgi_headers (environ )
2627 # Content type is generally not included as a header, do include this as a header to simplify :
2728 if "CONTENT_TYPE" in environ :
2829 headers ["CONTENT_TYPE" ] = [environ ["CONTENT_TYPE" ]]
Original file line number Diff line number Diff line change 22
33from typing import Dict , List
44
5+ from aikido_zen .helpers .headers import Headers
56
6- def extract_wsgi_headers (request ) -> Dict [str , List [str ]]:
7+
8+ def extract_wsgi_headers (request ) -> Headers :
79 """Extracts WSGI headers which start with HTTP_ from request dict"""
8- headers = {}
10+ headers = Headers ()
911 for key , value in request .items ():
1012 if key .startswith ("HTTP_" ):
1113 # Remove the 'HTTP_' prefix and store in the headers dictionary
12- headers [key [5 :]] = [value ]
14+ header_key = key [5 :]
15+ headers .store_header (header_key , value )
1316 return headers
You can’t perform that action at this time.
0 commit comments