Ignore JSON feeds from EnsureUnicode()

This commit is contained in:
Frédéric Guillot 2018-12-12 21:37:39 -08:00
parent 43ccaf52af
commit 6ae935309a

View file

@ -78,6 +78,11 @@ func (r *Response) EnsureUnicodeBody() (err error) {
return mediaErr
}
// JSON feeds are always in UTF-8.
if strings.Contains(mediaType, "json") {
return
}
if strings.Contains(mediaType, "xml") {
buffer, _ := ioutil.ReadAll(r.Body)
r.Body = bytes.NewReader(buffer)