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):
118118 allow_reuse_port = True
119119
120120 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
122122 super ().__init__ (* args , ** kwargs )
123123
124124 def server_bind (self ):
@@ -131,7 +131,10 @@ def server_bind(self):
131131 def finish_request (self , request , client_address ):
132132 """Finish one request by instantiating RequestHandlerClass."""
133133 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
135138 self .RequestHandlerClass (* args , ** kwargs )
136139
137140class ThreadingHTTPServer (socketserver .ThreadingMixIn , HTTPServer ):
You can’t perform that action at this time.
0 commit comments