Index: sdk/lib/io/http_body_impl.dart |
diff --git a/sdk/lib/io/http_body_impl.dart b/sdk/lib/io/http_body_impl.dart |
index 4bd9f8171cad26ee7bee0a7cb9654c699e82f9a2..f8431bd37101591fe47f578b62e097392d84fdc2 100644 |
--- a/sdk/lib/io/http_body_impl.dart |
+++ b/sdk/lib/io/http_body_impl.dart |
@@ -47,22 +47,26 @@ class _HttpBodyHandler implements HttpBodyHandler { |
.then((list) { |
dynamic content = list.readBytes(); |
String type = "binary"; |
- String mimeType = headers.contentType.toString(); |
+ ContentType contentType = headers.contentType; |
+ if (contentType == null) { |
+ return new _HttpBody(null, type, content); |
+ } |
+ String mimeType = "${contentType.primaryType}/${contentType.subType}"; |
Søren Gjesse
2013/04/15 11:11:28
Maybe add gettet type or value to class ContentTyp
Anders Johnsen
2013/04/15 11:19:26
Done.
|
String asText(Encoding defaultEncoding) { |
var encoding; |
- var charset = headers.contentType.charset; |
+ var charset = contentType.charset; |
if (charset != null) encoding = Encoding.fromName(charset); |
if (encoding == null) encoding = defaultEncoding; |
return _decodeString(content, encoding); |
} |
- switch (headers.contentType.primaryType) { |
+ switch (contentType.primaryType) { |
case "text": |
type = "text"; |
content = asText(Encoding.ASCII); |
break; |
case "application": |
- switch (headers.contentType.subType) { |
+ switch (contentType.subType) { |
case "json": |
content = JSON.parse(asText(Encoding.UTF_8)); |
type = "json"; |