v0.0.220 add ginext.bufferBody
This commit is contained in:
@@ -18,6 +18,7 @@ type GinWrapper struct {
|
||||
|
||||
allowCors bool
|
||||
ginDebug bool
|
||||
bufferBody bool
|
||||
requestTimeout time.Duration
|
||||
|
||||
routeSpecs []ginRouteSpec
|
||||
@@ -30,7 +31,13 @@ type ginRouteSpec struct {
|
||||
Handler string
|
||||
}
|
||||
|
||||
func NewEngine(allowCors bool, ginDebug bool, timeout time.Duration) *GinWrapper {
|
||||
// NewEngine creates a new (wrapped) ginEngine
|
||||
// Parameters are:
|
||||
// - [allowCors] Add cors handler to allow all CORS requests on the default http methods
|
||||
// - [ginDebug] Set gin.debug to true (adds more logs)
|
||||
// - [bufferBody] Buffers the input body stream, this way the ginext error handler can later include the whole request body
|
||||
// - [timeout] The default handler timeout
|
||||
func NewEngine(allowCors bool, ginDebug bool, bufferBody bool, timeout time.Duration) *GinWrapper {
|
||||
engine := gin.New()
|
||||
|
||||
wrapper := &GinWrapper{
|
||||
@@ -38,6 +45,7 @@ func NewEngine(allowCors bool, ginDebug bool, timeout time.Duration) *GinWrapper
|
||||
SuppressGinLogs: false,
|
||||
allowCors: allowCors,
|
||||
ginDebug: ginDebug,
|
||||
bufferBody: bufferBody,
|
||||
requestTimeout: timeout,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user