File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -71,13 +71,14 @@ def _construct_response_bytes( # pylint: disable=too-many-arguments
71
71
72
72
response = f"{ http_version } { status .code } { status .text } \r \n "
73
73
74
- headers = headers or {}
74
+ # Make a copy of the headers so that we don't modify the incoming dict
75
+ response_headers = {} if headers is None else headers .copy ()
75
76
76
- headers .setdefault ("Content-Type" , content_type )
77
- headers .setdefault ("Content-Length" , content_length or len (body ))
78
- headers .setdefault ("Connection" , "close" )
77
+ response_headers .setdefault ("Content-Type" , content_type )
78
+ response_headers .setdefault ("Content-Length" , content_length or len (body ))
79
+ response_headers .setdefault ("Connection" , "close" )
79
80
80
- for header , value in headers .items ():
81
+ for header , value in response_headers .items ():
81
82
response += f"{ header } : { value } \r \n "
82
83
83
84
response += f"\r \n { body } "
You can’t perform that action at this time.
0 commit comments