Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

378
Vistas
Starlette/FastApi route path components with forward slash

I have defined a route in Starlette/FastApi -

@router.post("/{part}")
def post_method(part):
    return "ok"

@router.post("/{part}/{another_part}")
def another_post_method(part, another_part):
    return "ok"

I have some forward slash in the path components, and I want to make the following request to access post_method

curl -X POST "http://127.0.0.1:5000/api/path%2Fpath" -H "accept: application/json" -d ""

results in the 404 error in the Starlette/Fastapi logs.

INFO: 127.0.0.1:50233 - "POST /api/path/path HTTP/1.1" 404

How to get the correct path components?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can use Starlette built-in path convertor

@app.route("/path/{param:path}", name="path-convertor")
over 4 years ago · Santiago Trujillo Denunciar

0

Response from Marcelo Trylesinski (Kludex) in fastapi gitter:

  1. It is not allowed
  2. Temporary solution: don't use path
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda