flet + fast_api always return http 200 OK or 302 even when path does not exist
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17k
- Forks
- 694
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 33
Description
Hi,
I'm experiencing the following issue with flet, flet-fastapi and uvicorn. The application always returns http 200 ok response when I would expect a 404 response I used following example app:
import flet as ft
import flet_fastapi
async def root_main(page: ft.Page):
await page.add_async(ft.Text("This is root app!"))
async def sub_main(page: ft.Page):
await page.add_async(ft.Text("This is sub app!"))
app = flet_fastapi.FastAPI()
app.mount("/sub-app", flet_fastapi.app(sub_main))
app.mount("/", flet_fastapi.app(root_main))
When browsing to something like http:\localhost\invalidurl I still get http response 200. How can I get HTTP response 404?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the response behavior with the example using flet_fastapi.FastAPI, the two app.mount calls, and Uvicorn, including an invalid path. Trace how the mounted root and sub-app routes handle unmatched paths; done means invalid URLs return HTTP 404 instead of 200 or 302 without breaking the valid routes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- api, backend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100