The JSON.stringify
-ed body of the request, if applicable.
The content-type
header is already present in FetcherResponseInfo.headers, so it's not necessary to set it yourself.
Whether to force HTTP/1[.1]
for the request.
The DevOps API does not support HTTP/2
, so such requests must only use HTTP/1
or HTTP/1.1
.
The base headers to include in the request.
Already included headers include:
content-type
user-agent
Authorization
or Token
, from token
options
embeddingApiKey
options
additionalHeaders
options
The HTTP method to use for the request.
Currently used methods:
GET
POST
DELETE
Future updates may require additional methods.
Creates a standardized timeout error for the request.
As an example, this is how the FetchNative implementation handles timeouts:
public async fetch(info: FetcherRequestInfo): Promise<FetcherResponseInfo> {
try {
const resp = await fetch(info.url, {
signal: AbortSignal.timeout(info.timeout),
...,
});
} catch (e) {
if (e instanceof Error && e.name === 'TimeoutError') {
throw info.mkTimeoutError();
}
throw e;
}
}
Of course, some http clients may offer a more straightforward way to handle timeouts, such as axios
's timeout
option, and may have different ways to express timeouts occurring.
Whatever the case, they should be appropriately set & handled to ensure the timeout is respected.
The timeout duration for the request, in milliseconds.
AbortSignal
or another valid timeout mechanism.mkTimeoutError()
.See FetcherRequestInfo.mkTimeoutError for more information on how to handle timeouts.
The full URL to which the request should be made.
This URL is preformatted, and already includes any necessary query parameters.
Overview
Represents the request information required to make an API request using a Fetcher.
Implementers should ensure that all request properties are correctly handled when making a request. Failing to do so may result in errors or unexpected behavior.
Key points of note
JSON.stringify
-ed.content-type
,user-agent
) are set but may be overridden.See