I am doing this
// dart
HttpRequest req = new HttpRequest();
req.open('GET', 'some-url');
req.overrideMimeType('text\/plain; charset=x-user-defined');
req.onLoadEnd.listen((e) {
if (req.status == 200) {
print(req.responseHeaders);
} else {
print('download failed');
}
});
req.send();
// angular-dart
_http.get('some-url', headers: {'Content-Type': 'text\/plain; charset=x-user-defined'})
.then((HttpResponse resp) {
print(resp.config.headers);
})
.catchError((e) {
print('download failed');
});
I was expecting to see the same header displayed twice. Instead, the dart call displays
{last-modified: Tue, 18 Mar 2014 18:04:00 GMT, content-type: text/plain; charset=x-user-defined, cache-control: public, max-age=2592000}
and the angular-dart one
{Accept: application/json, text/plain, */*}
The second header is the default one, so I conclude that I'm failing to set properly the header in the angular-dart http call. How can I fix this? Can you spot any other mistake?