Forbid `undefined` values on request and response objects
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.
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 https://github.com/MetaMask/utils/pull/138 and https://github.com/MetaMask/utils/pull/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.