feature request: `transformRequest` must be able to be asynchronous
Author: salisbury-espinosaCreated Apr 14, 2026Updated Jul 2, 2026
Labelstype::breaking
interceptor may be async => https://github.com/axios/axios/blob/main/index.d.cts#L514
for example
axios.interceptors.request.use(async (config) => {
try {
// Simulate an async call (e.g., getting a token from storage or an API)
const token = await getAuthToken();
// Modify headers
config.headers['Authorization'] = `Bearer ${token}`;
return config;
} catch (error) {
return Promise.reject(error);
}
});
the same behavior is needed in transformRequest
Source: axios/axios