From 676634850e186e7dc1268c88dad83cafdfebb2ac Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 10 Apr 2021 12:41:55 +0300 Subject: [PATCH] allow to set default content type with charset Signed-off-by: Vasiliy Tolstov --- handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handler.go b/handler.go index 9e21b53..3a9ede4 100644 --- a/handler.go +++ b/handler.go @@ -76,7 +76,7 @@ func (h *httpServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - ct := DefaultContentType + ct := strings.Split(DefaultContentType, ";")[0] if htype := r.Header.Get("Content-Type"); htype != "" { ct = strings.Split(htype, ";")[0] } @@ -85,7 +85,7 @@ func (h *httpServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { var err error switch ct { case "application/x-www-form-urlencoded": - cf, err = h.newCodec(DefaultContentType) + cf, err = h.newCodec(strings.Split(DefaultContentType, ";")[0]) default: cf, err = h.newCodec(ct) }