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.57k stars 1.33k forks source link

fix: handle BigInts that has a .toJSON property #1776

Closed bjornua closed 10 months ago

bjornua commented 10 months ago

Checklist

Problem

The recent changes introduced in https://github.com/ladjs/superagent/pull/1773 restricts the usage of BigInt with the .send() method, even if the BigInt object has a .toJSON method. In scenarios where developers want to serialize BigInt properties to JSON, this becomes a limitation.

Change

This pull request modifies the existing checks on BigInt values passed to the .send() method. With this change, if a BigInt property has a .toJSON method, it will not throw the "Cannot serialize BigInt value to json" error.

titanism commented 10 months ago

Fixed and released in v8.1.2 - thank you @bjornua

https://github.com/ladjs/superagent/releases/tag/v8.1.2