question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When a url contains colon, it makes 404 response. After I upgrade fastapi from 0.75.0 to 0.77.1.

See original GitHub issue

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn’t find it.
  • I searched the FastAPI documentation, with the integrated search.
  • I already searched in Google “How to X in FastAPI” and didn’t find any information.
  • I already read and followed all the tutorial in the docs and didn’t find an answer.
  • I already checked if it is not related to FastAPI but to Pydantic.
  • I already checked if it is not related to FastAPI but to Swagger UI.
  • I already checked if it is not related to FastAPI but to ReDoc.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

main.py

....
@app.post("/files:upload_homework")
async def create_file():
    ......

--------------------    
$ curl -X POST "http://127.0.0.1:8000/files:upload_homework"
{"detail":"Not Found"}%

------------
I run my fastapi App below command:

uvicorn main:app --host 0.0.0.0 --port 80

Description

It works in below packages:

$ pip freeze
anyio==3.5.0
asgiref==3.5.0
click==8.0.4
fastapi==0.75.0
h11==0.13.0
httptools==0.4.0
idna==3.3
Jinja2==3.0.3
MarkupSafe==2.1.1
pydantic==1.9.0
python-dotenv==0.19.2
python-multipart==0.0.5
pytz==2022.1
PyYAML==6.0
six==1.16.0
sniffio==1.2.0
starlette==0.17.1
typing-extensions==4.1.1
uvicorn==0.17.6
uvloop==0.16.0
watchgod==0.8.1
websockets==10.2

It can not works below packages:

$ pip freeze                                                
anyio==3.5.0
asgiref==3.5.0
click==8.0.4
fastapi==0.77.1
h11==0.13.0
httptools==0.4.0
idna==3.3
Jinja2==3.0.3
MarkupSafe==2.1.1
pydantic==1.9.0
python-dotenv==0.19.2
python-multipart==0.0.5
pytz==2022.1
PyYAML==6.0
six==1.16.0
sniffio==1.2.0
starlette==0.19.1
typing-extensions==4.1.1
uvicorn==0.17.6
uvloop==0.16.0
watchgod==0.8.1
websockets==10.2

Operating System

Linux, macOS

Operating System Details

No response

FastAPI Version

0.77.1

Python Version

Python 3.9.12

Additional Context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
bodograumanncommented, Sep 16, 2022

This issue is fixed in fastapi 0.85.0.

3reactions
Kludexcommented, Jun 7, 2022

Starlette 0.20.2 contains a fix for this. We’ve just released that version. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Question mark in POST method using FastAPI returns 404 error
The query is the set of key-value pairs that go after the ? in a URL, separated by & characters. URL Example:
Read more >
tiangolo/fastapi - Gitter
But how can I catch, for example, 404 error if it is tied directly to the StarletteException call. In default, if route doesn't...
Read more >
Fast API Tutorial, Part 19: Handling Errors - YouTube
... the item does not exist in the database then they'll need to receive a 404 error instead of a generic 400 error...
Read more >
How to override default 404 route not found : r/FastAPI - Reddit
I know it's of a misuse of the framework but I thought since it supports Template and HTML response so I just give...
Read more >
[Solved] Fastapi returns 404 when accessing URL in the ...
I am learning fastapi and created the sample following application ... I noticed another weird problem, when I make some error its not ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found