[Python] Question mark in POST method using FastAPI returns 404 error

Discussão em 'Python' iniciado por Stack, Setembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    Could you please explain to me why in FastAPI the following works:

    @app.post("/items/v1/cards{sku}")
    async def create_item(sku: str):
    return {"status":200,"sku":sku} # returns status:200 and sku


    but, the same endpoint with questionmark in it like the one given below does not?

    @app.post("/items/v1/cards?{sku}")
    async def create_item(sku: str):
    return {"sku":sku} # returns 404

    Continue reading...

Compartilhe esta Página