MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / options

Method options

src/ext/sockjs/tornado/basehandler.py:98–114  ·  view source on GitHub ↗

XHR cross-domain OPTIONS handler

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

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"""

Callers

nothing calls this directly

Calls 5

preflightMethod · 0.95
verify_originMethod · 0.95
enable_cacheMethod · 0.80
handle_session_cookieMethod · 0.80
finishMethod · 0.45

Tested by

no test coverage detected