Skip to content

Commit 7e02902

Browse files
fix: small fix for empty body
1 parent 5117748 commit 7e02902

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

request.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,16 @@ func getRequestInfo(r *http.Request, startTime time.Time) (RequestInfo, error) {
5555
return ri, err
5656
}
5757

58-
// mask all the JSON fields listed in Config.KeysToMask
59-
sanitizedJsonString, err := getMaskedJSON(body)
60-
if err != nil {
61-
return ri, err
58+
sanitizedJSONString := map[string]interface{}{}
59+
if len(body) > 0 {
60+
// mask all the JSON fields listed in Config.KeysToMask
61+
sanitizedJSONString, err = getMaskedJSON(body)
62+
if err != nil {
63+
return ri, err
64+
}
6265
}
6366

64-
ri.Body = sanitizedJsonString
67+
ri.Body = sanitizedJSONString
6568
}
6669
return ri, nil
6770
}

0 commit comments

Comments
 (0)