MCPcopy Index your code
hub / github.com/fastapi/fastapi / _is_frontend_navigation_request

Function _is_frontend_navigation_request

fastapi/routing.py:1986–2004  ·  view source on GitHub ↗
(scope: Scope)

Source from the content-addressed store, hash-verified

1984
1985
1986def _is_frontend_navigation_request(scope: Scope) -> bool:
1987 route_path = get_route_path(scope)
1988 final_segment = route_path.rsplit("/", 1)[-1]
1989 if os.path.splitext(final_segment)[1]:
1990 return False
1991 request = Request(scope)
1992 wildcard_accepted = False
1993 html_rejected = False
1994 for media_type, quality in _iter_accept_media_types(
1995 request.headers.get("accept", "")
1996 ):
1997 if media_type in {"text/html", "application/xhtml+xml"}:
1998 if quality == 0:
1999 html_rejected = True
2000 else:
2001 return True
2002 elif media_type == "*/*" and quality != 0:
2003 wildcard_accepted = True
2004 return wildcard_accepted and not html_rejected
2005
2006
2007class _FrontendRoute(BaseRoute):

Callers 1

get_responseMethod · 0.85

Calls 2

_iter_accept_media_typesFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…