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

134
Vistas
Locust Test payload with files

this is my first question and I would like to know how to send the following test parameters to my FastAPI API:

to: (string)
name: (string)
files: (array)

what is the correct syntax? I am trying with the following:

self.client.post ("/ email", dict (to = "", name = "", files = "hi.pdf"))
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Here's the Locust doc on post requests. https://docs.locust.io/en/stable/api.html#locust.clients.HttpSession.post

Locust's http classes are based on requests. There are multiple ways to do it. One way is to read file directly and post it by itself:

with open("hi.pdf", "rb") as hi:
    self.client.post("/email", data=hi.read())

I'm not familiar with FastAPI so I don't know where your to and name need to go. If they're headers, you can do:

with open("hi.pdf", "rb") as hi:
    self.client.post("/email", data=hi.read(), headers={"to": "", "name": ""})
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