-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcors.py
More file actions
25 lines (24 loc) · 660 Bytes
/
cors.py
File metadata and controls
25 lines (24 loc) · 660 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class CorsMiddleware:
def process_request(self, req, resp):
resp.set_header('Access-Control-Allow-Origin', '*')
resp.set_header(
'Access-Control-Allow-Headers',
','.join((
'Content-Type',
'Authorization',
'*',
))
)
resp.set_header(
'Access-Control-Allow-Methods',
','.join((
'DELETE',
'GET',
'HEAD',
'POST',
'PATCH',
'PUT',
)),
)
if req.method == 'OPTIONS':
resp.complete = True