Interface FetcherRequestInfo

The information required to make a request with a Fetcher. Please take all request information into account when making the request, or you may run into errors or unexpected behavior from your implementation.

interface FetcherRequestInfo {
    body: undefined | string;
    forceHttp1: undefined | boolean;
    headers: Record<string, string>;
    method: "DELETE" | "GET" | "POST";
    mkTimeoutError: (() => Error);
    timeout: number;
    url: string;
}

Properties

body: undefined | string

The JSON.stringified body of the request, if it exists. Make sure you're settings the content-type as application/json if applicable.

forceHttp1: undefined | boolean

Whether to force HTTP/1.1 for the request. This is important as the DevOps API does not support HTTP/2, and thus you may need to force HTTP/1.1 for certain requests if you're using a client that prefers HTTP/2.

headers: Record<string, string>

The base headers to include in the request (you may add or even override your own as necessary)

method: "DELETE" | "GET" | "POST"

The HTTP method to use for the request.

mkTimeoutError: (() => Error)

Creates the timeout error for the request (you may need to first catch your own timeout error and then call this method to create the new ubiquitous error).

Type declaration

    • (): Error
    • Returns Error

timeout: number

The timeout in milliseconds for the request.

url: string

The full URL to make the request to.