This commit is contained in:
2023-07-18 15:12:06 +02:00
parent f7d291056d
commit 1d629f6db8
6 changed files with 150 additions and 15 deletions

View File

@@ -1,6 +1,9 @@
package ginext
import "github.com/gin-gonic/gin"
import (
"github.com/gin-gonic/gin"
"time"
)
type GinWrapper struct {
engine *gin.Engine
@@ -9,9 +12,10 @@ type GinWrapper struct {
allowCors bool
ginDebug bool
returnRawErrors bool
requestTimeout time.Duration
}
func NewEngine(allowCors bool, ginDebug bool, returnRawErrors bool) *GinWrapper {
func NewEngine(allowCors bool, ginDebug bool, returnRawErrors bool, timeout time.Duration) *GinWrapper {
engine := gin.New()
wrapper := &GinWrapper{
@@ -20,6 +24,7 @@ func NewEngine(allowCors bool, ginDebug bool, returnRawErrors bool) *GinWrapper
allowCors: allowCors,
ginDebug: ginDebug,
returnRawErrors: returnRawErrors,
requestTimeout: timeout,
}
engine.RedirectFixedPath = false