HttpRequest

http.ql

Represents a single HTTP request.

Constructor Overview

Constructor Description
HttpRequest(method, url, headers, body)

Creates a new HTTP request. Recommended to use the static factory methods instead.

Function Overview

Function Description
static fun create(method, url, headers, body) Creates a new HTTP request with a specified method, to be sent with HttpClient.send().
static fun createGet(url, headers, body) Creates a new HTTP GET request to be sent with HttpClient.send().
static fun createPost(url, headers, body) Creates a new HTTP GET request to be sent with HttpClient.send().

Field Overview

Field Description
string method

The HTTP method to use for the request.

string url

The full URL of the request

Map headers

The headers to send with the request. Both key and values are strings.

string body

The body of the request.

int timeout

The timeout for the request in milliseconds.

int maxRedirects

The maximum number of redirects to follow.

Constructors

HttpRequest(method, url, headers, body) link

Creates a new HTTP request. Recommended to use the static factory methods instead.

Functions

static fun create(method, url, headers, body) link

Creates a new HTTP request with a specified method, to be sent with HttpClient.send().

Params
method ( string )

The HTTP method to use for the request

url ( string )

The URL to send the request to

headers ( Map )

The headers to send with the request

body

The body of the request. May either be a string or a Map

Returns HttpRequest

The created request

static fun createGet(url, headers, body) link

Creates a new HTTP GET request to be sent with HttpClient.send().

Params
url ( string )

The URL to send the request to

headers ( Map )

The headers to send with the request

body

The body of the request. May either be a string or a Map

Returns HttpRequest

The created request

static fun createPost(url, headers, body) link

Creates a new HTTP GET request to be sent with HttpClient.send().

Params
url ( string )

The URL to send the request to

headers ( Map )

The headers to send with the request

body

The body of the request. May either be a string or a Map

Returns HttpRequest

The created request