-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
The timeoutErrorMessage property in config not work with Node.js #4737
Copy link
Copy link
Closed
Description
Describe the bug
Upgrading from 0.26.1 to 0.27.2 cause:
The timeoutErrorMessage property in config not work with Node.js, expected custom error message, got "timeout of *ms exceeded"
note: #3580 is a merged/closed issue with the same exact problem
To Reproduce
import axios from 'axios';
import nock from 'nock';
const axiosInstance = axios.create({
timeout: 5000,
timeoutErrorMessage: 'Custom Timeout Error Message',
});
describe('test axios', () => {
it('should respect the timeoutErrorMessage property', async () => {
nock('http://localhost:4444/')
.get('/test')
.delayConnection(6000)
.reply(200);
const axprom = axiosInstance.get('http://localhost:4444/test');
await expect(axprom).rejects.toThrow('Custom Timeout Error Message');
}, 10000);
});Expected behavior
Expected: Custom Timeout Error Message
Got: timeout of 5000ms exceeded
Environment
- Axios Version: 0.27.2
- Adapter: nock
- Browser: n/a
- Browser Version : n/a
- Node.js Version: 16.13.1
- OS: macOS 11.6
- Additional Library Versions: n/a
Additional context/Screenshots
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
