From 4f8917a310c00682944c37a9d736cfc0a96b51ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Flc=E3=82=9B?= Date: Wed, 19 Apr 2023 10:20:14 +0800 Subject: [PATCH] fix: `With(opts...)` must be after `New` --- gin.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gin.go b/gin.go index d6f2fe03..c7cb61bc 100644 --- a/gin.go +++ b/gin.go @@ -221,8 +221,9 @@ func New(opts ...OptionFunc) *Engine { // Default returns an Engine instance with the Logger and Recovery middleware already attached. func Default(opts ...OptionFunc) *Engine { debugPrintWARNINGDefault() - engine := New(opts...) + engine := New() engine.Use(Logger(), Recovery()) + engine.With(opts...) return engine }