Skip to main content

index/functions/requestWithTimeout.md

requestWithTimeout(requestor, url, options, timeoutMs, kind?): Promise<HTTPResponse>

Sends one request through requestor, aborting it after timeoutMs (REQUEST_TIMEOUT). The caller's own abort passes through as it is. kind: { write: false } marks a read: its REQUEST_TIMEOUT, and a TRANSPORT_ERROR of the default requestors (which cannot tell a read from a write), then say write: false. Without it they are judged as a write's (fail-closed), which is what a write's transport needs before it decides what an unanswered write means.

Parameters​

ParameterType
requestorHttpRequestor
urlstring
optionsRequestInit
timeoutMsnumber
kind?RequestKind

Returns​

Promise<HTTPResponse>