sendHTTPRequest

Wraps sendHTTPRequestImpl by proxying calls to it via the persistentQuerier subthread.

Once the query returns, the response body is checked to see whether or not an error occurred. If so, it throws an exception with a descriptive message.

Note: Must be called from inside a Fiber.

version(TwitchSupport && WithTwitchPlugin)
package
sendHTTPRequest
(,
const string url
,
const string caller = __FUNCTION__
,
const string authorisationHeader = string.init
,
HttpVerb verb = HttpVerb.GET
,
ubyte[] body_ = null
,
const string contentType = string.init
,
int id = -1
,
const Flag!"recursing" recursing = No.recursing
)

Parameters

plugin TwitchPlugin

The current TwitchPlugin.

url string

The URL to query.

caller string

Name of the calling function.

authorisationHeader string

Authorisation HTTP header to pass.

verb HttpVerb

What HttpVerb to use in the request.

body_ ubyte[]

Request body to send in case of verbs like POST and PATCH.

contentType string

"Content-Type" HTTP header to pass.

id int

Numerical ID to use instead of generating a new one.

recursing Flag!"recursing"

Whether or not this is a recursive call and another one should not be attempted.

Return Value

The QueryResponse that was discovered while monitoring the bucket as having been received from the server.

Throws

TwitchQueryException if there were unrecoverable errors.

Examples

immutable QueryResponse = sendHTTPRequest(plugin, "https://id.twitch.tv/oauth2/validate", __FUNCTION__, "OAuth 30letteroauthstring");

Meta