fixup new codec detection

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-05-14 14:17:33 +03:00
parent d3d67eca97
commit 28d23f388f

View File

@ -251,8 +251,8 @@ func (h *httpServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set(k, v)
}
}
if ct != w.Header().Get("Content-Type") {
if cf, err = h.newCodec(ct); err != nil {
if nct := w.Header().Get("Content-Type"); nct != ct {
if cf, err = h.newCodec(nct); err != nil {
h.errorHandler(ctx, nil, w, r, err, http.StatusBadRequest)
return
}