HttpOptions

Allows configuration of additional options for when sending an HTTP request.

Summary

Constructors

HttpOptions(headers: table = {}, timeout: int = 30)

Properties

Name Type
timeout int
verifyCertificate bool
headers table

Methods

Method Returns
SetHeader(header: string, value: string) void
RemoveHeader(header: string) void
GetHeader(header: string) string
HasHeader(header: string) bool

Constructors

HttpOptions

HttpOptions(headers: table = {}, timeout: int = 30)

Parameters

Name Type Description
headers table An associative table containing the request headers.
timeout int The connection timeout in seconds.

Properties

timeout

int

The connection timeout in seconds.

verifyCertificate

bool

Whether to verify the remote SSL certificate. Defaults to true. Changing it to false is not recommended.

headers

table

An associative table containing the request headers.

Methods

SetHeader

SetHeader(header: string, value: string)

Sets the value of the header with the specified name. The User-Agent header cannot be set.

Parameters

Name Type Description
header string The case-insensitive header name (eg. Content-Type).
value string The header value (eg. application/json).

RemoveHeader

RemoveHeader(header: string)

Removes the header with the specified name. The User-Agent header cannot be removed.

Parameters

Name Type Description
header string The case-insensitive header name (eg. Content-Type).

GetHeader

GetHeader(header: string): string

Returns the value of a header with the specified name. If the header is not found it returns an empty string.

Parameters

Name Type Description
header string The case-insensitive header name (eg. Content-Type).

Returns

Type Description
string

HasHeader

HasHeader(header: string): bool

Checks if a header with the specified name exists.

Parameters

Name Type Description
header string The case-insensitive header name (eg. Content-Type).

Returns

Type Description
bool
Last modified April 27, 2020: Regenerate all API documentation (0b49d6be)