Skip to content

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

Merged
titanism merged 1 commit into
forwardemail:masterfrom
bjornua:bjornba/bigint-guard-fix
Aug 15, 2023
Merged

fix: handle BigInts that has a .toJSON property#1776
titanism merged 1 commit into
forwardemail:masterfrom
bjornua:bjornba/bigint-guard-fix

Conversation

@bjornua

@bjornua bjornua commented Aug 15, 2023

Copy link
Copy Markdown
Contributor

Checklist

  • I have ensured my pull request is not behind the main or master branch of the original repository.
  • I have rebased all commits where necessary so that reviewing this pull request can be done without having to merge it first.
  • I have written a commit message that passes commitlint linting.
  • I have ensured that my code changes pass linting tests.
  • I have ensured that my code changes pass unit tests.
  • I have described my pull request and the reasons for code changes along with context if necessary.

Problem

The recent changes introduced in #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 titanism merged commit b83887a into forwardemail:master Aug 15, 2023
@titanism

Copy link
Copy Markdown
Collaborator

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

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

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 this pull request may close these issues.

2 participants