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"))
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": ""})