diff --git a/CHANGELOG.md b/CHANGELOG.md index b43beb10b7..8c1d1b02f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.11.3+17 + +* Use new Dart 2 constant names. This branch is only for allowing existing + code to keep running under Dart 2. + ## 0.11.3+16 * Stop depending on the `stack_trace` package. diff --git a/lib/src/multipart_request.dart b/lib/src/multipart_request.dart index 8132f80924..3a0fc074b8 100644 --- a/lib/src/multipart_request.dart +++ b/lib/src/multipart_request.dart @@ -61,13 +61,13 @@ class MultipartRequest extends BaseRequest { fields.forEach((name, value) { length += "--".length + _BOUNDARY_LENGTH + "\r\n".length + - UTF8.encode(_headerForField(name, value)).length + - UTF8.encode(value).length + "\r\n".length; + utf8.encode(_headerForField(name, value)).length + + utf8.encode(value).length + "\r\n".length; }); for (var file in _files) { length += "--".length + _BOUNDARY_LENGTH + "\r\n".length + - UTF8.encode(_headerForFile(file)).length + + utf8.encode(_headerForFile(file)).length + file.length + "\r\n".length; } @@ -90,10 +90,10 @@ class MultipartRequest extends BaseRequest { var controller = new StreamController>(sync: true); void writeAscii(String string) { - controller.add(UTF8.encode(string)); + controller.add(utf8.encode(string)); } - writeUtf8(String string) => controller.add(UTF8.encode(string)); + writeUtf8(String string) => controller.add(utf8.encode(string)); writeLine() => controller.add([13, 10]); // \r\n fields.forEach((name, value) { diff --git a/lib/testing.dart b/lib/testing.dart index d5a7874201..d960f6e1e8 100644 --- a/lib/testing.dart +++ b/lib/testing.dart @@ -16,7 +16,7 @@ /// return new Response("", 404); /// } /// return new Response( -/// JSON.encode({ +/// json.encode({ /// 'numbers': [1, 4, 15, 19, 214] /// }), /// 200, diff --git a/pubspec.yaml b/pubspec.yaml index f3e584fd83..8adb27f8bf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: http -version: 0.11.3+16 +version: 0.11.3+17 author: "Dart Team " homepage: https://github.com/dart-lang/http description: A composable, Future-based API for making HTTP requests. @@ -11,4 +11,4 @@ dependencies: dev_dependencies: unittest: ">=0.9.0 <0.12.0" environment: - sdk: ">=1.23.0 <2.0.0" + sdk: ">=2.0.0-dev.61.0 <3.0.0" diff --git a/test/io/utils.dart b/test/io/utils.dart index 24276faff8..923ee8b287 100644 --- a/test/io/utils.dart +++ b/test/io/utils.dart @@ -99,7 +99,7 @@ Future startServer() { content['headers'][name] = values; }); - var body = JSON.encode(content); + var body = json.encode(content); response.contentLength = body.length; response.write(body); response.close(); diff --git a/test/mock_client_test.dart b/test/mock_client_test.dart index 48e635fee3..cd662e98d7 100644 --- a/test/mock_client_test.dart +++ b/test/mock_client_test.dart @@ -15,7 +15,7 @@ void main() { test('handles a request', () { var client = new MockClient((request) { return new Future.value(new http.Response( - JSON.encode(request.bodyFields), 200, + json.encode(request.bodyFields), 200, request: request, headers: {'content-type': 'application/json'})); }); diff --git a/test/utils.dart b/test/utils.dart index 1bc78f7405..862a3c4403 100644 --- a/test/utils.dart +++ b/test/utils.dart @@ -52,7 +52,7 @@ class _Parse extends Matcher { var parsed; try { - parsed = JSON.decode(item); + parsed = json.decode(item); } catch (e) { return false; } @@ -81,7 +81,7 @@ class _BodyMatches extends Matcher { if (item is! http.MultipartRequest) return false; var future = item.finalize().toBytes().then((bodyBytes) { - var body = UTF8.decode(bodyBytes); + var body = utf8.decode(bodyBytes); var contentType = new MediaType.parse(item.headers['content-type']); var boundary = contentType.parameters['boundary']; var expected = cleanUpLiteral(_pattern)