|
|
@ -87,10 +87,9 @@ 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(name, a) |
|
|
|
codec := encoding.GetCodec(a) |
|
|
|
codec := encoding.GetCodec(a) |
|
|
|
if codec != nil { |
|
|
|
if codec != nil { |
|
|
|
return codec, true |
|
|
|
return codec, true |
|
|
|