李伟乐 2 years ago
parent a6b5431106
commit 97952f7dfe
  1. 3
      transport/http/codec.go

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

Loading…
Cancel
Save