Type of the parsed response data
Type of request headers used in the config
Type of request params used in the config
Type of response headers received from the server
Configuration used for the request.
The merged configuration object that was used to make this request, including instance-level settings and request-specific overrides. Useful for debugging and understanding how the request was configured.
Parsed response body data.
The response content parsed according to the content-type header or the configured determineType function. For JSON responses, this will be the parsed JavaScript object. For text responses, this will be a string.
HTTP response headers received from the server.
A plain object containing the response headers with type-safe access to headers you've defined in the InstanceResponseHeaders interface. All header names are preserved as-is from the server response.
// Define your response headers
declare module '@logosdx/fetch' {
namespace FetchEngine {
interface InstanceResponseHeaders {
'x-rate-limit': string;
'x-request-id': string;
}
}
}
// Now TypeScript knows about your response headers
const response = await api.get('/users');
const rateLimit = response.headers['x-rate-limit'];
const requestId = response.headers['x-request-id'];
Original request object.
The Request object that was sent to the server, containing the final URL, headers, method, and body after all modifications and merging of instance and request-specific options.
HTTP status code.
The numeric HTTP status code (200, 404, 500, etc.) returned by the server. Useful for conditional logic based on response status without needing to catch errors.
Enhanced response object that provides comprehensive information about a fetch request and its result.
Replaces the previous pattern of returning just parsed data with a rich response object containing the data, metadata, and request context. Designed to be easily destructurable while providing full access to HTTP response details.
Example
Example
Example