Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The timeoutErrorMessage property in config not work with Node.js #3580

Closed
duibu05 opened this issue Jan 22, 2021 · 1 comment · Fixed by #3581
Closed

The timeoutErrorMessage property in config not work with Node.js #3580

duibu05 opened this issue Jan 22, 2021 · 1 comment · Fixed by #3581

Comments

@duibu05
Copy link
Contributor

duibu05 commented Jan 22, 2021

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

image

duibu05 added a commit to duibu05/axios that referenced this issue Jan 22, 2021
…os#3580)

* Adding "should respect the timeoutErrorMessage property" test case

Co-authored-by: Will Loo <duibu05@126.com>
duibu05 added a commit to duibu05/axios that referenced this issue Jan 22, 2021
…os#3580)

* Fixing The timeoutErrorMessage property in config not work with Node.js (axios#3580)

* Updating http adapter

* Adding reject config.timeoutErrorMessage when setup

Co-authored-by: Will Loo <duibu05@126.com>
duibu05 added a commit to duibu05/axios that referenced this issue Aug 17, 2021
…js (axios#3580)

* Fixing The timeoutErrorMessage property in config not work with Node.js (axios#3580)

* Update http adapter

* Make changes as suggested after code review

Co-authored-by: Will Loo <duibu05@126.com>
@duibu05 duibu05 changed the title The timeoutErrorMessage property in config not work with Node.js The timeoutErrorMessage property in config not work with Node.js [#3581] Aug 19, 2021
@duibu05 duibu05 changed the title The timeoutErrorMessage property in config not work with Node.js [#3581] The timeoutErrorMessage property in config not work with Node.js Aug 19, 2021
@duibu05
Copy link
Contributor Author

duibu05 commented Aug 19, 2021

fixed by #3581

jasonsaayman added a commit that referenced this issue Jan 18, 2022
fixes #3580) (#3581)

* The timeoutErrorMessage property in config not work with Node.js (#3580)

* Adding "should respect the timeoutErrorMessage property" test case

Co-authored-by: Will Loo <duibu05@126.com>

* The timeoutErrorMessage property in config not work with Node.js (#3580)

* Fixing The timeoutErrorMessage property in config not work with Node.js (#3580)

* Updating http adapter

* Adding reject config.timeoutErrorMessage when setup

Co-authored-by: Will Loo <duibu05@126.com>

* Fixing The timeoutErrorMessage property in config not work with Node.js (#3580)

* Fixing The timeoutErrorMessage property in config not work with Node.js (#3580)

* Update http adapter

* Make changes as suggested after code review

Co-authored-by: Will Loo <duibu05@126.com>

Co-authored-by: Jay <jasonsaayman@gmail.com>
mbargiel pushed a commit to mbargiel/axios that referenced this issue Jan 27, 2022
fixes axios#3580) (axios#3581)

* The timeoutErrorMessage property in config not work with Node.js (axios#3580)

* Adding "should respect the timeoutErrorMessage property" test case

Co-authored-by: Will Loo <duibu05@126.com>

* The timeoutErrorMessage property in config not work with Node.js (axios#3580)

* Fixing The timeoutErrorMessage property in config not work with Node.js (axios#3580)

* Updating http adapter

* Adding reject config.timeoutErrorMessage when setup

Co-authored-by: Will Loo <duibu05@126.com>

* Fixing The timeoutErrorMessage property in config not work with Node.js (axios#3580)

* Fixing The timeoutErrorMessage property in config not work with Node.js (axios#3580)

* Update http adapter

* Make changes as suggested after code review

Co-authored-by: Will Loo <duibu05@126.com>

Co-authored-by: Jay <jasonsaayman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant