李伟乐 2 years ago
parent e9532833ac
commit d85cc06557
  1. 2
      transport/http/codec.go

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

Loading…
Cancel
Save