Parcourir la source

Ignore JSON feeds from EnsureUnicode()

Frédéric Guillot il y a 7 ans
Parent
commit
6ae935309a
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 5 0
      http/client/response.go

+ 5 - 0
http/client/response.go

@@ -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)