Search code examples
pythonlocust

Locust: how to specify a get request who takes query parameter


I want to load test my get request which is

http://localhost:8080/v1/synonyms/project/?keyword=dealer

and test method is

@task(2)
def get_synonym(self):
    response = self.client.get("/v1/synonyms/project/")
    print("Response status code:", response.status_code)
    print("Response content:", response.text)

Solution

  • pass the query string in the url:

    response = self.client.get("/v1/synonyms/project/?keyword=dealer")