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

Preserve custom err.status from ok callback #1608

Closed jeremyruppel closed 2 years ago

jeremyruppel commented 3 years ago

Currently if you throw an error in a custom .ok callback, and that error has a .status property, it will be accessible in the node client but is overwritten by the response status in the browser client. This patch also adds the .status property to the error caught from the .ok callback if it didn't have one.

niftylettuce commented 2 years ago

Can you resolve these conflicts? Would merge once done