chore: replace deprecated method (#2667)

pull/2670/head
jessetang 2 years ago committed by GitHub
parent 27eadd83b4
commit 6330a5688e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      contrib/log/zap/zap.go
  2. 3
      transport/http/codec.go

@ -25,7 +25,7 @@ func (l *Logger) Log(level log.Level, keyvals ...interface{}) error {
return nil
}
var data []zap.Field = make([]zap.Field, 0, (keylen/2)+1)
data := make([]zap.Field, 0, (keylen/2)+1)
for i := 0; i < keylen; i += 2 {
data = append(data, zap.Any(fmt.Sprint(keyvals[i]), keyvals[i+1]))
}

@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
@ -67,7 +66,7 @@ func DefaultRequestDecoder(r *http.Request, v interface{}) error {
data, err := io.ReadAll(r.Body)
// reset body.
r.Body = ioutil.NopCloser(bytes.NewBuffer(data))
r.Body = io.NopCloser(bytes.NewBuffer(data))
if err != nil {
return errors.BadRequest("CODEC", err.Error())

Loading…
Cancel
Save