← Code LabNode.js0/50 solved · 0%
Web3 · medium

28. JSON-RPC Validator

Check for `jsonrpc: '2.0'` and `method` fields.

Write `isValid(req)` that returns true only when `req.jsonrpc` is `'2.0'`, `req.method` is a string and `req.id` is defined — the minimum a relayer should accept.
Required in your answer: jsonrpc === '2.0'typeof req.method