[#369] Add base64 encoding of body
Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
This commit is contained in:
parent
9ccd191e6e
commit
99e0af1cd0
1 changed files with 2 additions and 1 deletions
|
@ -4,6 +4,7 @@ package middleware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -156,7 +157,7 @@ func withBody(httplog *zap.Logger, r *http.Request) (*zap.Logger, error) {
|
||||||
defer r.Body.Close()
|
defer r.Body.Close()
|
||||||
r.Body = io.NopCloser(bytes.NewBuffer(body))
|
r.Body = io.NopCloser(bytes.NewBuffer(body))
|
||||||
|
|
||||||
httplog = httplog.With(zap.String("body", string(body)))
|
httplog = httplog.With(zap.String("body", base64.StdEncoding.EncodeToString(body)))
|
||||||
|
|
||||||
return httplog, nil
|
return httplog, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue