Hi guys, I got a problem with the header.
> Invalid header field name, with 128
I'm using an iOS simulator. And if I not mistaken iOS simulator works well with localhost, in general, I have a information emulator that cannot access the localhost. That's why I have a decision it is maybe a bug.
When I use another header such as
```dart
headers: {
HttpHeaders.contentTypeHeader: 'application/json'
},
```
After that, I got different errors like that.
> flutter: Bad state: Cannot set the body fields of a Request with content-type "application/json".
One important thing FYI, _when I use the JSON MOCK SERVER, it works very well_, after switching DOCKER environment I got the error. I would like to add other details. I also test my real back-end code which is works on the docker environment, **I test on the browser with fetch API, and also angular application works well**. _I think that there is not related to my back-end or such kind of CORS issues._
```dart
Future<void> login(String email, String password) async {
try {
final http.Response response = await
http.post(
url,
body: {
'email': email,
'password': password,
'device_name': 'apple',
},
);
if (response.statusCode != 200) {
throw HttpException('An error occored ${response.statusCode}');
}
final user = json.decode(response.body);
_token = user['data']['token'];
_email = email;
final SharedPreferences sharedPreferences =
await SharedPreferences.getInstance();
final userData = json.encode({
'token': _token,
'email': _email,
});
sharedPreferences.setString('userData', userData);
notifyListeners();
} catch (exception) {
throw exception;
}
}
```