This commit is contained in:
Mike Schwörer 2023-08-08 16:05:44 +02:00
parent 87a004e577
commit 655d4daad9
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
3 changed files with 6 additions and 8 deletions

View File

@ -5,10 +5,8 @@ import (
"gogs.mikescher.com/BlackForestBytes/goext/dataext" "gogs.mikescher.com/BlackForestBytes/goext/dataext"
) )
func BodyBuffer() gin.HandlerFunc { func BodyBuffer(g *gin.Context) {
return func(g *gin.Context) {
if g.Request.Body != nil { if g.Request.Body != nil {
g.Request.Body = dataext.NewBufferedReadCloser(g.Request.Body) g.Request.Body = dataext.NewBufferedReadCloser(g.Request.Body)
} }
} }
}

View File

@ -113,7 +113,7 @@ func (w *GinRouteBuilder) Handle(handler WHandlerFunc) {
if w.routes.wrapper.bufferBody { if w.routes.wrapper.bufferBody {
arr := make([]gin.HandlerFunc, 0, len(w.handlers)+1) arr := make([]gin.HandlerFunc, 0, len(w.handlers)+1)
arr = append(arr, BodyBuffer()) arr = append(arr, BodyBuffer)
arr = append(arr, w.handlers...) arr = append(arr, w.handlers...)
w.handlers = arr w.handlers = arr
} }

View File

@ -1,5 +1,5 @@
package goext package goext
const GoextVersion = "0.0.228" const GoextVersion = "0.0.229"
const GoextVersionTimestamp = "2023-08-08T15:33:52+0200" const GoextVersionTimestamp = "2023-08-08T16:05:44+0200"