Handling cross-domain requests: check the source of the request and set headers
(self, context: HttpContext)
| 192 | cls._webio_expire.pop(sid, None) |
| 193 | |
| 194 | def _process_cors(self, context: HttpContext): |
| 195 | """Handling cross-domain requests: check the source of the request and set headers""" |
| 196 | origin = context.request_headers().get('Origin', '') |
| 197 | if self.check_origin(origin): |
| 198 | context.set_header('Access-Control-Allow-Origin', origin) |
| 199 | context.set_header('Access-Control-Allow-Methods', 'GET, POST') |
| 200 | context.set_header('Access-Control-Allow-Headers', 'content-type, webio-session-id') |
| 201 | context.set_header('Access-Control-Expose-Headers', 'webio-session-id') |
| 202 | context.set_header('Access-Control-Max-Age', str(1440 * 60)) |
| 203 | |
| 204 | def interval_cleaning(self): |
| 205 | # clean up at intervals |
no test coverage detected