mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 19:08:20 +00:00
check for jsonrpc version
This commit is contained in:
parent
7cf945d4ab
commit
5e43a48766
1 changed files with 4 additions and 0 deletions
|
@ -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))
|
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]
|
method, ok := h.methods[req.Method]
|
||||||
if !ok {
|
if !ok {
|
||||||
return respondError(w, "", ErrMethodNotFound, fmt.Errorf("Unknown Method %v", req.Method))
|
return respondError(w, "", ErrMethodNotFound, fmt.Errorf("Unknown Method %v", req.Method))
|
||||||
|
|
Loading…
Add table
Reference in a new issue