Is it possible to have Locust pass a header command with a secure token to load test an API?
I am trying to test our api for an encoder with a header flag for a token as the server being tested has to receive a token with the request, ie.
curl -H “Authorization: Token token string” http://someserver
Yes, you can use:
token_string = "token string"
resp = self.client.post(
url="http://someserver",
data=json.dumps(data),
auth=None,
headers={"authorization": "Token " + token_string},
name="http://someserver",
)