From 766e5b0d891368539c115f516a66232915c71f02 Mon Sep 17 00:00:00 2001 From: MaoWei Date: Sun, 28 Jun 2020 15:55:58 +0800 Subject: [PATCH] fix(tonic): bind query and header --- tonic/handler.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tonic/handler.go b/tonic/handler.go index 5db56f2..dfed184 100644 --- a/tonic/handler.go +++ b/tonic/handler.go @@ -84,11 +84,21 @@ func Handler(h interface{}, status int, options ...func(*Route)) gin.HandlerFunc handleError(c, bindError) return } + // Bind query-parameters. + if err := bind(c, input, QueryTag, extractQuery); err != nil { + handleError(c, err) + return + } // Bind path arguments. if err := bind(c, input, PathTag, extractPath); err != nil { handleError(c, err) return } + // Bind headers. + if err := bind(c, input, HeaderTag, extractHeader); err != nil { + handleError(c, err) + return + } // validating query and path inputs if they have a validate tag initValidator() args = append(args, input)