From 824706362f7fbce6f2f5be5e8d79b513b4b81dde 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:53:40 +0800 Subject: [PATCH] x --- transport/http/codec.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/transport/http/codec.go b/transport/http/codec.go index 357c471..3ad3ade 100644 --- a/transport/http/codec.go +++ b/transport/http/codec.go @@ -37,9 +37,7 @@ func DefaultRequestQuery(r *http.Request, v any) error { return binding.BindQuery(r.URL.Query(), v) } func DefaultRequestDecoder(r *http.Request, v any) error { - fmt.Println("DefaultRequestDecoder") - codec, ok := CodeForRequest(r, "Content-type") - fmt.Println("request decoder", ok) + codec, ok := CodeForRequest(r, "Content-Type") if !ok { return errors.BadRequest("CODEC", fmt.Sprintf("unregister Content-Type: %s", codec)) } @@ -87,11 +85,8 @@ func DefaultErrorEncoder(w http.ResponseWriter, r *http.Request, err error) { _, _ = w.Write(body) } func CodeForRequest(r *http.Request, name string) (encoding.Codec, bool) { - fmt.Printf("%+v\n", r.Header) for _, accept := range r.Header[name] { - a := httputil.ContentSubtype(accept) - fmt.Println(name, a) - codec := encoding.GetCodec(a) + codec := encoding.GetCodec(httputil.ContentSubtype(accept)) if codec != nil { return codec, true }