MCPcopy
hub / github.com/bugy/script-server / redirect

Function redirect

src/utils/tornado_utils.py:32–40  ·  view source on GitHub ↗
(full_url, request_handler, *args, **kwargs)

Source from the content-addressed store, hash-verified

30
31
32def redirect(full_url, request_handler, *args, **kwargs):
33 if is_ajax(request_handler.request):
34 # For AJAX we need custom handling because of:
35 # 1. browsers ignore url fragments (#hash) of redirects inside ajax
36 # 2. redirecting ajax to external resources causes allowed origin header issues
37 request_handler.set_header('Location', full_url)
38 request_handler.set_status(200)
39 else:
40 request_handler.redirect(full_url, *args, **kwargs)
41
42
43def get_full_url(relative_url, request_handler):

Callers 1

redirect_relativeFunction · 0.85

Calls 1

is_ajaxFunction · 0.85

Tested by

no test coverage detected