-
Notifications
You must be signed in to change notification settings - Fork 390
Description
I am requesting some information from the a server, which returns the following (using postman):
Headers:
Allow →GET, HEAD, OPTIONS
CF-RAY →439e4801cf3db955-MIA
Connection →keep-alive
Content-Encoding →gzip
Content-Type →application/json
Body:
{
"name": "SARA LUCIA OSSA PEÑA",
}
But, using http, I am getting the following (using a simple request get('url')):
{
"name": "SARA LUCIA OSSA PE�A",
}
To fix this, I had to do something like:
UTF8.decode(response.bodyBytes)
This works as expected, and the information is retrieved fine. This, however, is a pain to setup (and inconsistent with post, where utf8 is used as default encoding).
Is there a better way to handle this? An argument to the get parameter to force encoding? shouldn't application/json assume utf8 by default?
I came up with the solution after reading https://pub.dartlang.org/documentation/http/latest/http/Response-class.html and the body property. Probably it is encoding the body with a wrong format.
Anyway, thanks for the hard work. Awesome library.