From 80fd696b5c554c25e3af26aa30633bb6452d34eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Flc=E3=82=9B?= Date: Sun, 7 Jan 2024 22:43:00 +0800 Subject: [PATCH] fix(gin): Fixed some configurations not taking effect when executing the `Option` method. (#64) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Flcă‚› --- gin/server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gin/server.go b/gin/server.go index 7c1d9a0f..aea20b8f 100644 --- a/gin/server.go +++ b/gin/server.go @@ -30,15 +30,15 @@ func NewServer(e *gin.Engine, opts ...Option) *Server { addr: ":8080", } + for _, opt := range opts { + opt(srv) + } + srv.server = &http.Server{ Addr: srv.addr, Handler: e, } - for _, opt := range opts { - opt(srv) - } - return srv }