Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

133
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda