Description
Originally opened as dart-lang/sdk#17062
This issue was originally filed by [email protected]
When using the code snippet below, the content-type header is overloaded by "text/plain".
import 'package:http/http.dart' as Http;
Http.post(url, body: postData, headers: { "Content-Type": "text/xml" })
As we can't set _contentType from Request class, could you add 'content-type' in basic client requests also ? (see 'request.dart' source code)
set body(String value) {
bodyBytes = encoding.encode(value);
var contentType = _contentType;
if (contentType == null) {
contentType = new ContentType("text", "plain", charset: encoding.name);
} else if (contentType.charset == null) {
contentType = new ContentType(contentType.primaryType,
contentType.subType,
charset: encoding.name,
parameters: contentType.parameters);
}
_contentType = contentType;
}
Environement
Dart VM version: 1.1.3 (Thu Feb 06 00:05:52 2014) on "windows_ia32"
http package: http-0.9.2+3