Properly specify Content-Transfer-Encoding.
Closes #39
R=rnystrom@google.com
Review URL: https://codereview.chromium.org//2125783003 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 23935ba..24f8878 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.11.3+8
+
+* Properly specify `Content-Transfer-Encoding` for multipart chunks.
+
## 0.11.3+7
* Declare compatibility with `http_parser` 3.0.0.
diff --git a/lib/src/multipart_request.dart b/lib/src/multipart_request.dart
index f589eaa..9e145c7 100644
--- a/lib/src/multipart_request.dart
+++ b/lib/src/multipart_request.dart
@@ -18,8 +18,7 @@
/// [files].
///
/// This request automatically sets the Content-Type header to
-/// `multipart/form-data` and the Content-Transfer-Encoding header to `binary`.
-/// These values will override any values set by the user.
+/// `multipart/form-data`. This value will override any value set by the user.
///
/// var uri = Uri.parse("http://pub.dartlang.org/packages/create");
/// var request = new http.MultipartRequest("POST", url);
@@ -85,7 +84,6 @@
// TODO(nweiz): freeze fields and files
var boundary = _boundaryString();
headers['content-type'] = 'multipart/form-data; boundary="$boundary"';
- headers['content-transfer-encoding'] = 'binary';
super.finalize();
var controller = new StreamController<List<int>>(sync: true);
@@ -135,7 +133,9 @@
var header =
'content-disposition: form-data; name="${_browserEncode(name)}"';
if (!isPlainAscii(value)) {
- header = '$header\r\ncontent-type: text/plain; charset=utf-8';
+ header = '$header\r\n'
+ 'content-type: text/plain; charset=utf-8\r\n'
+ 'content-transfer-encoding: binary\r\n';
}
return '$header\r\n\r\n';
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 77eaafd..370a7e1 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: http
-version: 0.11.3+7
+version: 0.11.3+8
author: "Dart Team <misc@dartlang.org>"
homepage: https://github.com/dart-lang/http
description: A composable, Future-based API for making HTTP requests.