Skip to content

Commit 346ed15

Browse files
committed
Fix constant names.
1 parent 332d6cf commit 346ed15

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.11.3+17
2+
3+
* Use new Dart 2 constant names. This branch is only for allowing existing
4+
code to keep running under Dart 2.
5+
16
## 0.11.3+16
27

38
* Stop depending on the `stack_trace` package.

lib/src/multipart_request.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ class MultipartRequest extends BaseRequest {
6161

6262
fields.forEach((name, value) {
6363
length += "--".length + _BOUNDARY_LENGTH + "\r\n".length +
64-
UTF8.encode(_headerForField(name, value)).length +
65-
UTF8.encode(value).length + "\r\n".length;
64+
utf8.encode(_headerForField(name, value)).length +
65+
utf8.encode(value).length + "\r\n".length;
6666
});
6767

6868
for (var file in _files) {
6969
length += "--".length + _BOUNDARY_LENGTH + "\r\n".length +
70-
UTF8.encode(_headerForFile(file)).length +
70+
utf8.encode(_headerForFile(file)).length +
7171
file.length + "\r\n".length;
7272
}
7373

@@ -90,10 +90,10 @@ class MultipartRequest extends BaseRequest {
9090
var controller = new StreamController<List<int>>(sync: true);
9191

9292
void writeAscii(String string) {
93-
controller.add(UTF8.encode(string));
93+
controller.add(utf8.encode(string));
9494
}
9595

96-
writeUtf8(String string) => controller.add(UTF8.encode(string));
96+
writeUtf8(String string) => controller.add(utf8.encode(string));
9797
writeLine() => controller.add([13, 10]); // \r\n
9898

9999
fields.forEach((name, value) {

lib/testing.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/// return new Response("", 404);
1717
/// }
1818
/// return new Response(
19-
/// JSON.encode({
19+
/// json.encode({
2020
/// 'numbers': [1, 4, 15, 19, 214]
2121
/// }),
2222
/// 200,

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: http
2-
version: 0.11.3+16
2+
version: 0.11.3+17
33
author: "Dart Team <[email protected]>"
44
homepage: https://github.com/dart-lang/http
55
description: A composable, Future-based API for making HTTP requests.
@@ -11,4 +11,4 @@ dependencies:
1111
dev_dependencies:
1212
unittest: ">=0.9.0 <0.12.0"
1313
environment:
14-
sdk: ">=1.23.0 <2.0.0"
14+
sdk: ">=2.0.0-dev.61.0 <3.0.0"

test/io/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Future startServer() {
9999
content['headers'][name] = values;
100100
});
101101

102-
var body = JSON.encode(content);
102+
var body = json.encode(content);
103103
response.contentLength = body.length;
104104
response.write(body);
105105
response.close();

test/mock_client_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void main() {
1515
test('handles a request', () {
1616
var client = new MockClient((request) {
1717
return new Future.value(new http.Response(
18-
JSON.encode(request.bodyFields), 200,
18+
json.encode(request.bodyFields), 200,
1919
request: request, headers: {'content-type': 'application/json'}));
2020
});
2121

test/utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class _Parse extends Matcher {
5252

5353
var parsed;
5454
try {
55-
parsed = JSON.decode(item);
55+
parsed = json.decode(item);
5656
} catch (e) {
5757
return false;
5858
}
@@ -81,7 +81,7 @@ class _BodyMatches extends Matcher {
8181
if (item is! http.MultipartRequest) return false;
8282

8383
var future = item.finalize().toBytes().then((bodyBytes) {
84-
var body = UTF8.decode(bodyBytes);
84+
var body = utf8.decode(bodyBytes);
8585
var contentType = new MediaType.parse(item.headers['content-type']);
8686
var boundary = contentType.parameters['boundary'];
8787
var expected = cleanUpLiteral(_pattern)

0 commit comments

Comments
 (0)