Class HttpClient
Index
Constructors
Methods
Constructors
constructor
Creates a new HttpClient instance
Parameters
- config: HttpClientConfig
Client configuration
Returns HttpClient
- config: HttpClientConfig
Methods
get
Makes a GET request
Type Parameters
Parameters
- path: string
API path to request
Optionaloptions: RequestOptionsOptional request options
Returns Promise<T>
Promise resolving to the parsed JSON response
- path: string
post
Makes a POST request
Type Parameters
Parameters
- path: string
API path to request
Optionalbody: unknownRequest body (will be JSON stringified)
Optionaloptions: RequestOptionsOptional request options
Returns Promise<T>
Promise resolving to the parsed JSON response
- path: string
request
Makes an HTTP request with automatic retries and timeout handling
Implements exponential backoff for retries:
- 1st retry: wait 1 second
- 2nd retry: wait 2 seconds
- 3rd retry: wait 4 seconds
Client errors (4xx) are not retried.
Type Parameters
Parameters
- path: string
API path to request (will be appended to baseUrl)
- options: RequestOptions = {}
Request options (method, headers, body, timeout)
Returns Promise<T>
Promise resolving to the parsed JSON response
HTTP client with built-in retry logic and timeout handling
Features:
Example