1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-12-28 03:00:28 +01:00

rm http_server.py

This commit is contained in:
Marek Kaluba 2022-02-12 15:18:39 +01:00
parent 8f295b8bc6
commit 8555393004
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -1,16 +0,0 @@
#!/usr/bin/env python3
# encoding: utf-8
"""Use instead of `python3 -m http.server` when you need CORS"""
from http.server import HTTPServer, SimpleHTTPRequestHandler
class CORSRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Access-Control-Allow-Origin', '*')
self.send_header('Access-Control-Allow-Methods', 'GET')
self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate')
return super(CORSRequestHandler, self).end_headers()
httpd = HTTPServer(('localhost', 8003), CORSRequestHandler)
httpd.serve_forever()