Skip to main content

HttpRequest

Upgather SDK


Upgather SDK / HttpRequest

Class: HttpRequest

Represents an HTTP request.

Remarks

This class encapsulates the properties of an HTTP request, including the URL, HTTP method, headers, and body.

Constructors

new HttpRequest()

new HttpRequest(url, method, headers?, body?): HttpRequest

Creates an instance of HttpRequest.

Parameters

url

string

The URL of the request.

method

string

The HTTP method to use.

headers?

Map<string, string>

(Optional) A map of header keys and values.

body?

Json

(Optional) The body of the request.

Returns

HttpRequest

Properties

body

body: Json

The body of the HTTP request.


headers

headers: Map<string, string>

The headers of the HTTP request.


method

method: string

The HTTP method (e.g., GET, POST).


url

url: string

The URL of the HTTP request.

Methods

setHeader()

setHeader(key, value): void

Sets a header for the HTTP request.

Parameters

key

string

The header key.

value

string

The header value.

Returns

void