File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ class HTTPServer(socketserver.TCPServer):
118
118
allow_reuse_port = True
119
119
120
120
def __init__ (self , * args , response_headers = None , ** kwargs ):
121
- self .response_headers = response_headers if response_headers is not None else {}
121
+ self .response_headers = response_headers
122
122
super ().__init__ (* args , ** kwargs )
123
123
124
124
def server_bind (self ):
@@ -131,7 +131,10 @@ def server_bind(self):
131
131
def finish_request (self , request , client_address ):
132
132
"""Finish one request by instantiating RequestHandlerClass."""
133
133
args = (request , client_address , self )
134
- kwargs = dict (response_headers = self .response_headers ) if self .response_headers else dict ()
134
+ kwargs = {}
135
+ response_headers = getattr (self , 'response_headers' , None )
136
+ if response_headers :
137
+ kwargs ['response_headers' ] = self .response_headers
135
138
self .RequestHandlerClass (* args , ** kwargs )
136
139
137
140
class ThreadingHTTPServer (socketserver .ThreadingMixIn , HTTPServer ):
You can’t perform that action at this time.
0 commit comments