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
1 changed files with 5 additions and 0 deletions

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)