mockthereum icon indicating copy to clipboard operation
mockthereum copied to clipboard

Id as body param

Open ernaneluis opened this issue 1 year ago • 1 comments

Viem.sh adds a new param called id into body, but mock does not catch it. https://github.com/httptoolkit/mockthereum/blob/7305bf991705b54421e66c3e4de94adbd8c3a02e/src/jsonrpc.ts#L12 Is there a way to extend this rules?

Screenshot 2023-09-06 at 6 08 32 PM

ernaneluis avatar Sep 06 '23 16:09 ernaneluis

Hmm, I'm not sure what you mean - the matcher here should match requests that contain id - it's a flexible JSON match, meaning the request must include the fields specified, but can include extra fields too.

I think the issue is that the body here doesn't include params: [], which is supposed to be required. That might be a bug in Viem.sh, as every example I've seen (e.g. every method example listed on https://ethereum.org/en/developers/docs/apis/json-rpc/) does include this.

Do you know if there's any formal documentation that defines whether that's required?

pimterry avatar Sep 07 '23 15:09 pimterry