Skip to content

HTTP

formatting...

Task performs a HTTP request to a specified endpoint.

This is useful if the scenario is using a non-HTTP user or a request to a URL other than the one under testing is needed, e.g. for testdata.

Step implementations

Arguments

Name Type Description Default
direction RequestDirection impicit specified by which step implementation is used required
endpoint str URL to perform GET request from required
name str name used in locust statistics required

Authentication

To enable authentication for HttpClientTask the auth context tree has to be correctly set. This is done by using Set context variable step, where the branches are prefixed with <host>/, e.g.:

And value for variable "foobar" is "none"
And value for variable "url" is "https://www.example.com/api/test"
And set context variable "www.example.com/auth.user.username" to "bob"
And set context variable "www.example.com/auth.user.password" to "password"
And set context variable "www.example.com/auth.user.redirect_uri" to "/authenticated"
And set context variable "www.example.com/auth.provider" to "https://login.example.com/oauth2"
And set context variable "www.example.com/auth.client.id" to "aaaa-bbbb-cccc-dddd"

Then get from "https://{{ url }}" with name "authenticated-get" and save response payload in "foobar"

This will make any requests towards www.example.com to get a token from http://login.example.com/oauth2 and use it in any requests towards www.example.com.

For more details, see [AAD][grizzly.auth.aad] documentation.