XHR cross-domain OPTIONS handler
(self, *args, **kwargs)
| 96 | |
| 97 | @asynchronous |
| 98 | def options(self, *args, **kwargs): |
| 99 | """XHR cross-domain OPTIONS handler""" |
| 100 | self.enable_cache() |
| 101 | self.handle_session_cookie() |
| 102 | self.preflight() |
| 103 | |
| 104 | if self.verify_origin(): |
| 105 | allowed_methods = getattr(self, 'access_methods', 'OPTIONS, POST') |
| 106 | self.set_header('Access-Control-Allow-Methods', allowed_methods) |
| 107 | self.set_header('Allow', allowed_methods) |
| 108 | |
| 109 | self.set_status(204) |
| 110 | else: |
| 111 | # Set forbidden |
| 112 | self.set_status(403) |
| 113 | |
| 114 | self.finish() |
| 115 | |
| 116 | def preflight(self): |
| 117 | """Handles request authentication""" |
nothing calls this directly
no test coverage detected