李伟乐 2 years ago
parent 205a5e9a0f
commit fcf1efdaa5
  1. 5
      transport/http/codec.go

@ -87,8 +87,9 @@ func DefaultErrorEncoder(w http.ResponseWriter, r *http.Request, err error) {
}
func CodeForRequest(r *http.Request, name string) (encoding.Codec, bool) {
for _, accept := range r.Header[name] {
fmt.Println(accept)
codec := encoding.GetCodec(httputil.ContentSubtype(accept))
a := httputil.ContentSubtype(accept)
fmt.Println("aaa", a)
codec := encoding.GetCodec(a)
if codec != nil {
return codec, true
}

Loading…
Cancel
Save