-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
The timeoutErrorMessage property in config not work with Node.js #3580
Copy link
Copy link
Closed
Description
Describe the bug
The timeoutErrorMessage property in config not work with Node.js, expected custom error message, got "timeout of *ms exceeded"
To Reproduce
it('should respect the timeoutErrorMessage property', function (done) {
server = http.createServer(function (req, res) {
setTimeout(function () {
res.end();
}, 1000);
}).listen(4444, function () {
var success = false, failure = false;
var error;
axios.get('http://localhost:4444/', {
timeout: 250,
timeoutErrorMessage: 'oops, timeout',
}).then(function (res) {
success = true;
}).catch(function (err) {
error = err;
failure = true;
});
setTimeout(function () {
assert.strictEqual(success, false, 'request should not succeed');
assert.strictEqual(failure, true, 'request should fail');
assert.strictEqual(error.code, 'ECONNABORTED');
assert.strictEqual(error.message, 'oops, timeout');
done();
}, 300);
});
});Expected behavior
Expected: oops, timeout
Got: timeout of 250ms exceeded
Environment
- Axios Version: 0.21.1
- Adapter: HTTP
- Browser: none
- Browser Version: none
- Node.js Version: 12.19.0
- OS: MacOS 10.14
- Additional Library Versions: none
Additional context/Screenshots
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
