UNPKG

askui

Version:

Reliable, automated end-to-end-testing that depends on what is shown on your screen instead of the technology you are running on

45 lines (44 loc) 1.72 kB
import { OptionsOfJSONResponseBody } from 'got'; import http from 'http'; import https from 'https'; export declare class HttpClientGot { readonly token?: string | undefined; readonly customHeaders?: Record<string, string> | undefined; private readonly cookies; readonly proxyAgents?: { http: http.Agent; https: https.Agent; } | undefined; private headers; private askuiGot; urlsToRetry: string[]; constructor(token?: string | undefined, customHeaders?: Record<string, string> | undefined, cookies?: Record<string, string>, proxyAgents?: { http: http.Agent; https: https.Agent; } | undefined); /** * Configures got with retry behavior for transient server errors. * * Got retries requests that fail with retryable status codes * (500, 502, 503, 504, etc.) up to `limit` times using exponential backoff. * * POST requests are only retried if their URL is registered in `urlsToRetry` * (see `shouldRetryOnError`), to avoid retrying non-idempotent calls * to unknown endpoints. */ private buildGotExtendOptions; /** * Only retry POST requests if the URL is explicitly registered in `urlsToRetry` * (populated by InferenceClient with inference endpoint URLs). * Non-POST requests (GET, PUT, etc.) are always retried. */ private shouldRetryOnError; private shouldRetryPostRequest; private initHeaders; private injectHeadersAndCookies; post<T>(url: string, data: Record<string | number | symbol, unknown>): Promise<{ headers: http.IncomingHttpHeaders; body: T; }>; get<T>(url: string, options?: OptionsOfJSONResponseBody): Promise<T>; }