From 090b5e3c07596e35cd87f88b431c355baf7c20b4 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 29 May 2023 12:26:56 +0300 Subject: [PATCH] fix query param struct filling Signed-off-by: Vasiliy Tolstov --- handler.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/handler.go b/handler.go index 6b2c088..3f01bd6 100644 --- a/handler.go +++ b/handler.go @@ -487,10 +487,12 @@ func (h *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } } - matches = rflutil.FlattenMap(matches) - if err = rflutil.Merge(argv.Interface(), matches, rflutil.SliceAppend(true), rflutil.Tags([]string{"protobuf", "json"})); err != nil { - h.errorHandler(ctx, handler, w, r, err, http.StatusBadRequest) - return + if len(matches) > 0 { + matches = rflutil.FlattenMap(matches) + if err = rflutil.Merge(argv.Interface(), matches, rflutil.SliceAppend(true), rflutil.Tags([]string{"protobuf", "json"})); err != nil { + h.errorHandler(ctx, handler, w, r, err, http.StatusBadRequest) + return + } } hr := &rpcRequest{ -- 2.45.2