MCPcopy Index your code
hub / github.com/hunvreus/devpush / RedirectResponseX

Function RedirectResponseX

app/dependencies.py:499–516  ·  view source on GitHub ↗

Drop-in replacement for FastAPI RedirectResponse. • If `request` is an HTMX call ⇒ send HX-Redirect header. • Otherwise ⇒ delegate to FastAPI's RedirectResponse.

(
    url: str,
    status_code: int = status.HTTP_307_TEMPORARY_REDIRECT,
    headers: dict[str, str] | None = None,
    request: Request | None = None,
)

Source from the content-addressed store, hash-verified

497
498
499def RedirectResponseX(
500 url: str,
501 status_code: int = status.HTTP_307_TEMPORARY_REDIRECT,
502 headers: dict[str, str] | None = None,
503 request: Request | None = None,
504):
505 """
506 Drop-in replacement for FastAPI RedirectResponse.
507 • If `request` is an HTMX call ⇒ send HX-Redirect header.
508 • Otherwise ⇒ delegate to FastAPI's RedirectResponse.
509 """
510
511 if request is not None and request.headers.get("HX-Request"):
512 return FastAPIResponse(
513 status_code=200,
514 headers={"HX-Redirect": str(url), **(headers or {})},
515 )
516 return FastAPIRedirect(url=url, status_code=status_code, headers=headers)
517
518
519def time_ago_filter(value):

Callers 10

user_notificationsFunction · 0.90
new_project_detailsFunction · 0.90
project_storageFunction · 0.90
project_deployFunction · 0.90
project_redeployFunction · 0.90
project_cancel_deployFunction · 0.90
project_settingsFunction · 0.90
project_logsFunction · 0.90
auth_loginFunction · 0.90
team_storageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected