Skip to content

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

@kevinGan

Description

@kevinGan

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions