More CORS support
This adds CORS preflight support to the test server. Change-Id: I0029e4f8a7056e86dc8a2b6df6f7d935f9ee772d
This commit is contained in:
parent
0b136c764c
commit
2f200e65b9
0
openstack_catalog/web/static/blank.json
Normal file
0
openstack_catalog/web/static/blank.json
Normal file
@ -18,10 +18,22 @@ import SocketServer
|
||||
|
||||
|
||||
class AllowOriginRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
print("App Catalog Versions:",
|
||||
self.headers.get('X-App-Catalog-Versions', ''))
|
||||
return SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
|
||||
|
||||
def end_headers(self):
|
||||
self.send_header("Access-Control-Allow-Origin", "*")
|
||||
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
|
||||
|
||||
def do_OPTIONS(self):
|
||||
self.send_response(200)
|
||||
self.send_header("Access-Control-Allow-Origin", "*")
|
||||
self.send_header("Access-Control-Allow-Headers",
|
||||
"X-App-Catalog-Versions")
|
||||
self.send_header("Allow", "GET")
|
||||
|
||||
if __name__ == '__main__':
|
||||
PORT = 18001
|
||||
httpd = SocketServer.TCPServer(("", PORT), AllowOriginRequestHandler)
|
||||
|
Loading…
x
Reference in New Issue
Block a user