MCPcopy
hub / github.com/cft0808/edict / cors_headers

Function cors_headers

dashboard/server.py:79–89  ·  view source on GitHub ↗
(h)

Source from the content-addressed store, hash-verified

77
78
79def cors_headers(h):
80 req_origin = h.headers.get('Origin', '')
81 if ALLOWED_ORIGIN:
82 origin = ALLOWED_ORIGIN
83 elif req_origin in _DEFAULT_ORIGINS:
84 origin = req_origin
85 else:
86 origin = f'http://127.0.0.1:{_DASHBOARD_PORT}'
87 h.send_header('Access-Control-Allow-Origin', origin)
88 h.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
89 h.send_header('Access-Control-Allow-Headers', 'Content-Type')
90
91
92def _iter_task_data_dirs():

Callers 4

do_OPTIONSMethod · 0.85
send_jsonMethod · 0.85
send_fileMethod · 0.85
do_POSTMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected