pub fn request(
client: &mut Client,
parameters: Map,
) -> Result<Dynamic, Box<EvalAltResult>>
Expand description
Execute an HTTP request.
§Args
parameter
: A map of parameters with the following fields:method
: the method to use. (e.g. “POST”, “GET”, etc.)url
: Endpoint to query.headers
: Optional headers to add to the query.body
: Optional body to add to the query.output
: Output format of the response retrieved by the client, can either be ‘text’ or ‘json’. Defaults to ‘text’.
§Errors
- The url failed to be parsed
- Headers failed to be parsed
- The request failed
§Example
let client = http::client();
let response = client.request(#{
method: "GET",
url: "http://example.com"
});
print(response)