From 3e26df4f38f78a0f77183c4823cd17a25dc2de0b Mon Sep 17 00:00:00 2001 From: a <a@a.a> Date: Thu, 3 Nov 2022 00:32:34 -0500 Subject: [PATCH] minor tweak --- client.go | 2 ++ mux.go | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index 8a9a145..03ec9bf 100644 --- a/client.go +++ b/client.go @@ -279,6 +279,8 @@ func (c *Client) call(ctx context.Context, result any, msg *jsonrpcMessage) erro return resp.Error case len(resp.Result) == 0: return ErrNoResult + case result == nil: + return nil default: return jzon.Unmarshal(resp.Result, &result) } diff --git a/mux.go b/mux.go index 6b908cb..d8a4e3e 100644 --- a/mux.go +++ b/mux.go @@ -10,12 +10,12 @@ import ( var _ Router = &Mux{} -// Mux is a simple HTTP route multiplexer that parses a request path, +// Mux is a simple JRPC route multiplexer that parses a request path, // records any URL params, and executes an end handler. It implements // the Handler interface and is friendly with the standard library. // // Mux is designed to be fast, minimal and offer a powerful API for building -// modular and composable HTTP services with a large set of handlers. It's +// modular and composable JRPC services with a large set of handlers. It's // particularly useful for writing large REST API services that break a handler // into many smaller parts composed of middlewares and end handlers. type Mux struct { @@ -356,7 +356,7 @@ func (mx *Mux) handle(pattern string, handler Handler) *node { return mx.tree.InsertRoute(pattern, h) } -// routeHTTP routes a Request through the Mux routing tree to serve +// routeJRPC routes a Request through the Mux routing tree to serve // the matching handler for a particular http method. func (mx *Mux) routeRPC(w ResponseWriter, r *Request) { // Grab the route context object -- GitLab