File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -216,18 +216,20 @@ directory. This script will serve the tree locally.
216216from http.server import HTTPServer, SimpleHTTPRequestHandler
217217import sys
218218
219-
220219class CORSRequestHandler (SimpleHTTPRequestHandler ):
221-
220+
222221 def end_headers (self ):
223222 self .send_header(' Access-Control-Allow-Origin' , ' *' )
224- self .send_header(' Access-Control-Allow-Methods' , ' * ' )
225- self .send_header(' Access-Control-Allow-Headers' , ' * ' )
223+ self .send_header(' Access-Control-Allow-Methods' , ' GET, POST, OPTIONS ' )
224+ self .send_header(' Access-Control-Allow-Headers' , ' Content-Type, Authorization ' )
226225 self .send_header(' Cache-Control' , ' no-store, no-cache, must-revalidate' )
227226 return super (CORSRequestHandler, self ).end_headers()
228227
229228 def do_OPTIONS (self ):
230229 self .send_response(200 )
230+ self .send_header(' Access-Control-Allow-Origin' , ' *' )
231+ self .send_header(' Access-Control-Allow-Methods' , ' GET, POST, OPTIONS' )
232+ self .send_header(' Access-Control-Allow-Headers' , ' Content-Type, Authorization' )
231233 self .end_headers()
232234
233235host = sys.argv[1 ] if len (sys.argv) > 2 else ' 0.0.0.0'
You can’t perform that action at this time.
0 commit comments