v0.0.240
This commit is contained in:
parent
56094b3cb6
commit
202afc9068
@ -322,22 +322,38 @@ func (b *Builder) GinReq(ctx context.Context, g *gin.Context, req *http.Request)
|
|||||||
if ctxVal := g.GetString("reqid"); ctxVal != "" {
|
if ctxVal := g.GetString("reqid"); ctxVal != "" {
|
||||||
b.Str("gin.context.reqid", ctxVal)
|
b.Str("gin.context.reqid", ctxVal)
|
||||||
}
|
}
|
||||||
if req.Method != "GET" && req.Body != nil && req.Header.Get("Content-Type") == "application/json" {
|
if req.Method != "GET" && req.Body != nil {
|
||||||
if brc, ok := req.Body.(dataext.BufferedReadCloser); ok {
|
|
||||||
if bin, err := brc.BufferedAll(); err == nil {
|
if req.Header.Get("Content-Type") == "application/json" {
|
||||||
if len(bin) < 16*1024 {
|
if brc, ok := req.Body.(dataext.BufferedReadCloser); ok {
|
||||||
var prettyJSON bytes.Buffer
|
if bin, err := brc.BufferedAll(); err == nil {
|
||||||
err = json.Indent(&prettyJSON, bin, "", " ")
|
if len(bin) < 16*1024 {
|
||||||
if err == nil {
|
var prettyJSON bytes.Buffer
|
||||||
b.Str("gin.body", string(prettyJSON.Bytes()))
|
err = json.Indent(&prettyJSON, bin, "", " ")
|
||||||
|
if err == nil {
|
||||||
|
b.Str("gin.body", string(prettyJSON.Bytes()))
|
||||||
|
} else {
|
||||||
|
b.Bytes("gin.body", bin)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
b.Bytes("gin.body", bin)
|
b.Str("gin.body", fmt.Sprintf("[[%v bytes | %s]]", len(bin), req.Header.Get("Content-Type")))
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
b.Str("gin.body", fmt.Sprintf("[[%v bytes]]", len(bin)))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.Header.Get("Content-Type") == "multipart/form-data" || req.Header.Get("Content-Type") == "x-www-form-urlencoded" {
|
||||||
|
if brc, ok := req.Body.(dataext.BufferedReadCloser); ok {
|
||||||
|
if bin, err := brc.BufferedAll(); err == nil {
|
||||||
|
if len(bin) < 16*1024 {
|
||||||
|
b.Bytes("gin.body", bin)
|
||||||
|
} else {
|
||||||
|
b.Str("gin.body", fmt.Sprintf("[[%v bytes | %s]]", len(bin), req.Header.Get("Content-Type")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
b.containsGinData = true
|
b.containsGinData = true
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.239"
|
const GoextVersion = "0.0.240"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2023-08-11T16:32:34+0200"
|
const GoextVersionTimestamp = "2023-08-14T15:36:12+0200"
|
||||||
|
Loading…
Reference in New Issue
Block a user