File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,7 +72,9 @@ def values(self):
7272
7373 def update (self , headers : Dict [str , str ]):
7474 """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+ )
7678
7779 def copy (self ):
7880 """Returns a copy of the headers."""
@@ -97,4 +99,4 @@ def __contains__(self, key: str):
9799 return key .lower () in self ._storage .keys ()
98100
99101 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:
119119 """Parse HTTP headers from raw request."""
120120 header_lines = header_bytes .decode ("utf8" ).splitlines ()[1 :]
121121
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
5353 """
5454 self .status = status if isinstance (status , HTTPStatus ) else HTTPStatus (* status )
5555 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+ )
5759 self .content_type = content_type
5860 self .filename = filename
5961 self .root_path = root_path
@@ -73,7 +75,9 @@ def _construct_response_bytes( # pylint: disable=too-many-arguments
7375 response = f"{ http_version } { status .code } { status .text } \r \n "
7476
7577 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+ )
7781 headers .setdefault ("Connection" , "close" )
7882
7983 for header , value in headers .items ():
You can’t perform that action at this time.
0 commit comments