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

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

Merged
merged 1 commit into from
Aug 15, 2023
Merged

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

merged 1 commit into from
Aug 15, 2023

Conversation

bjornua
Copy link
Contributor

@bjornua bjornua commented Aug 15, 2023

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 ladjs:master Aug 15, 2023
@titanism
Copy link
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