ladjs / superagent

Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
https://ladjs.github.io/superagent/
MIT License
16.58k stars 1.33k forks source link

abort will not emit error if retry is set. #1596

Open bear-boss opened 3 years ago

bear-boss commented 3 years ago

When the retry count is set. call abort() on the request won't throw the Abort Error. And the retry callback's param can not get the Abort Error.((err, res) => boolean). Since the abort function is called by user. I think the request should not retry or it should pass the abort error to the retry callback and leave it for user to decide?

ulisesbocchio commented 3 years ago

Having the same issue here, wonder if you can just remove:

if (_this._maxRetries && _this._maxRetries > _this._retries) {
    return;
}

from RequestBase.prototype.then's abort listener

niftylettuce commented 2 years ago

PR welcome w/tests