check for jsonrpc version

This commit is contained in:
Samuel Lorch 2023-03-05 20:51:43 +01:00
parent 7cf945d4ab
commit 5e43a48766

View file

@ -40,6 +40,10 @@ func (h *Handler) HandleRequest(ctx context.Context, r io.Reader, w io.Writer) e
return respondError(w, "", ErrParse, fmt.Errorf("Parsing Request: %w", err))
}
if req.Jsonrpc != "2.0" {
return respondError(w, "", ErrMethodNotFound, fmt.Errorf("Unsupported Jsonrpc version %v", req.Jsonrpc))
}
method, ok := h.methods[req.Method]
if !ok {
return respondError(w, "", ErrMethodNotFound, fmt.Errorf("Unknown Method %v", req.Method))