allow to set default content type with charset
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
		| @@ -76,7 +76,7 @@ func (h *httpServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	ct := DefaultContentType | 	ct := strings.Split(DefaultContentType, ";")[0] | ||||||
| 	if htype := r.Header.Get("Content-Type"); htype != "" { | 	if htype := r.Header.Get("Content-Type"); htype != "" { | ||||||
| 		ct = strings.Split(htype, ";")[0] | 		ct = strings.Split(htype, ";")[0] | ||||||
| 	} | 	} | ||||||
| @@ -85,7 +85,7 @@ func (h *httpServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |||||||
| 	var err error | 	var err error | ||||||
| 	switch ct { | 	switch ct { | ||||||
| 	case "application/x-www-form-urlencoded": | 	case "application/x-www-form-urlencoded": | ||||||
| 		cf, err = h.newCodec(DefaultContentType) | 		cf, err = h.newCodec(strings.Split(DefaultContentType, ";")[0]) | ||||||
| 	default: | 	default: | ||||||
| 		cf, err = h.newCodec(ct) | 		cf, err = h.newCodec(ct) | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user