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

Method _fallback_response

fastapi/routing.py:1954–1966  ·  view source on GitHub ↗
(
        self, fallback: str, scope: Scope, *, status_code: int
    )

Source from the content-addressed store, hash-verified

1952 return stat_result is not None and stat.S_ISREG(stat_result.st_mode)
1953
1954 async def _fallback_response(
1955 self, fallback: str, scope: Scope, *, status_code: int
1956 ) -> Response:
1957 full_path, stat_result = await run_in_threadpool(self.lookup_path, fallback)
1958 if stat_result is None or not stat.S_ISREG(stat_result.st_mode):
1959 raise RuntimeError(
1960 f"Frontend fallback file '{fallback}' does not exist in "
1961 f"directory '{self.directory}'. Resolved absolute directory: "
1962 f"'{self._get_resolved_directory()}'"
1963 )
1964 return self.file_response(
1965 full_path, stat_result, scope, status_code=status_code
1966 )
1967
1968
1969def _iter_accept_media_types(accept: str) -> Iterator[tuple[str, float]]:

Callers 1

get_responseMethod · 0.95

Calls 1

Tested by

no test coverage detected