diff options
Diffstat (limited to 'http/client/response.go')
-rw-r--r-- | http/client/response.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/http/client/response.go b/http/client/response.go index 8fcaa26..340fa07 100644 --- a/http/client/response.go +++ b/http/client/response.go @@ -84,7 +84,12 @@ func (r *Response) EnsureUnicodeBody() (err error) { // We ignore documents with encoding specified in XML prolog. // This is going to be handled by the XML parser. - if xmlEncodingRegex.Match(buffer[0:1024]) { + length := 1024 + if len(buffer) < 1024 { + length = len(buffer) + } + + if xmlEncodingRegex.Match(buffer[0:length]) { return } } |