File tree Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Expand file tree Collapse file tree 3 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,9 @@ def values(self):
72
72
73
73
def update (self , headers : Dict [str , str ]):
74
74
"""Updates the headers with the given dict."""
75
- return self ._storage .update ({key .lower (): [key , value ] for key , value in headers .items ()})
75
+ return self ._storage .update (
76
+ {key .lower (): [key , value ] for key , value in headers .items ()}
77
+ )
76
78
77
79
def copy (self ):
78
80
"""Returns a copy of the headers."""
@@ -97,4 +99,4 @@ def __contains__(self, key: str):
97
99
return key .lower () in self ._storage .keys ()
98
100
99
101
def __repr__ (self ):
100
- return f' { self .__class__ .__name__ } ({ dict (self ._storage .values ())} )'
102
+ return f" { self .__class__ .__name__ } ({ dict (self ._storage .values ())} )"
Original file line number Diff line number Diff line change @@ -119,8 +119,10 @@ def _parse_headers(header_bytes: bytes) -> HTTPHeaders:
119
119
"""Parse HTTP headers from raw request."""
120
120
header_lines = header_bytes .decode ("utf8" ).splitlines ()[1 :]
121
121
122
- return HTTPHeaders ({
123
- name : value
124
- for header_line in header_lines
125
- for name , value in [header_line .split (": " , 1 )]
126
- })
122
+ return HTTPHeaders (
123
+ {
124
+ name : value
125
+ for header_line in header_lines
126
+ for name , value in [header_line .split (": " , 1 )]
127
+ }
128
+ )
Original file line number Diff line number Diff line change @@ -53,7 +53,9 @@ def __init__( # pylint: disable=too-many-arguments
53
53
"""
54
54
self .status = status if isinstance (status , HTTPStatus ) else HTTPStatus (* status )
55
55
self .body = body
56
- self .headers = headers .copy () if isinstance (headers , HTTPHeaders ) else HTTPHeaders (headers )
56
+ self .headers = (
57
+ headers .copy () if isinstance (headers , HTTPHeaders ) else HTTPHeaders (headers )
58
+ )
57
59
self .content_type = content_type
58
60
self .filename = filename
59
61
self .root_path = root_path
@@ -73,7 +75,9 @@ def _construct_response_bytes( # pylint: disable=too-many-arguments
73
75
response = f"{ http_version } { status .code } { status .text } \r \n "
74
76
75
77
headers .setdefault ("Content-Type" , content_type )
76
- headers .setdefault ("Content-Length" , content_length or len (body .encode ("utf-8" )))
78
+ headers .setdefault (
79
+ "Content-Length" , content_length or len (body .encode ("utf-8" ))
80
+ )
77
81
headers .setdefault ("Connection" , "close" )
78
82
79
83
for header , value in headers .items ():
You can’t perform that action at this time.
0 commit comments