Skip to content

Blank space for :path in path parameter #2251

@jamfie

Description

@jamfie

Hi. Was going through the documentation regarding path parameters. I realize it works when

from fastapi import FastAPI

app = FastAPI()


@app.get('/files/{file_path:path}')
async def read_file(file_path: str):
    return({"file_path": f_path})

but return 404 when

from fastapi import FastAPI

app = FastAPI()


@app.get('/files/{file_path: path}')
async def read_file(file_path: str):
    return({"file_path": f_path})

Notice how there is a blank space after the colon for the wrong demonstration: file_path: path. Is this behavior expected?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions