From 205a5e9a0fd72fab9c341942eb1a08592576c473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F=E4=B9=90?= Date: Tue, 14 Mar 2023 14:15:06 +0800 Subject: [PATCH] x --- transport/http/codec.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/transport/http/codec.go b/transport/http/codec.go index 869e7b1..dac6808 100644 --- a/transport/http/codec.go +++ b/transport/http/codec.go @@ -38,6 +38,7 @@ func DefaultRequestQuery(r *http.Request, v any) error { } func DefaultRequestDecoder(r *http.Request, v any) error { codec, ok := CodeForRequest(r, "Content-type") + fmt.Println(codec, ok) if !ok { return errors.BadRequest("CODEC", fmt.Sprintf("unregister Content-Type: %s", codec)) } @@ -86,6 +87,7 @@ 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)) if codec != nil { return codec, true