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

Forbid undefined values on request and response objects #139

Open
rekmarks opened this issue May 18, 2021 · 1 comment
Open

Forbid undefined values on request and response objects #139

rekmarks opened this issue May 18, 2021 · 1 comment

Comments

@rekmarks
Copy link
Member

Here's the problem:

> JSON.stringify({ foo: undefined })
'{}'

Any request or response objects that are serialized before being transported will lose any fields with the value undefined. Introspecting params or errors to suss out such fields is beyond the scope of this package, but there's an argument that we should throw errors if we detect that any top-level top-level request or response property exists and has the value undefined.

That may also be out of scope for this package, but this is as good a place to track it as any.

@legobeat
Copy link
Contributor

legobeat commented Sep 6, 2023

For those using TypeScript, types have improved here as of MetaMask/json-rpc-engine#162.

An effort to add runtime validation for these cases have recently been explored in #138 and #136.

In either, case, this issue belongs in https://github.com/MetaMask/utils so moving it there from https://github.com/MetaMask/json-rpc-engine.

@legobeat legobeat transferred this issue from MetaMask/json-rpc-engine Sep 6, 2023
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

No branches or pull requests

2 participants