Skip to main content

getHTTPClient()

function getHTTPClient(config?: {
baseURL?: string;
headers?: RequestConfig;
sendLogRocketSessionHeader?: boolean;
}): AxiosInstance;

Creates a basic HTTP client instance using Axios. The client includes request/response interceptors and automatic retry logic.

Parameters

config?

Configuration options

baseURL?

string = ...

Base URL for API requests (defaults to app config value)

headers?

RequestConfig = {}

Custom headers to include in requests

sendLogRocketSessionHeader?

boolean = false

Include LogRocket session URL in headers

Returns

AxiosInstance

Configured Axios instance

Example

const client = getHTTPClient({
baseURL: 'https://api.example.com',
headers: { 'X-Custom-Header': 'value' }
});
const response = await client.get('/endpoint');