Skip to content

Commit

Permalink
Fix constant names.
Browse files Browse the repository at this point in the history
  • Loading branch information
lrhn committed Jul 6, 2018
1 parent 332d6cf commit 346ed15
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 5 additions & 5 deletions lib/src/multipart_request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -90,10 +90,10 @@ class MultipartRequest extends BaseRequest {
var controller = new StreamController<List<int>>(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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/testing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/// return new Response("", 404);
/// }
/// return new Response(
/// JSON.encode({
/// json.encode({
/// 'numbers': [1, 4, 15, 19, 214]
/// }),
/// 200,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: http
version: 0.11.3+16
version: 0.11.3+17
author: "Dart Team <misc@dartlang.org>"
homepage: https://github.com/dart-lang/http
description: A composable, Future-based API for making HTTP requests.
Expand All @@ -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"
2 changes: 1 addition & 1 deletion test/io/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion test/mock_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'}));
});

Expand Down
4 changes: 2 additions & 2 deletions test/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class _Parse extends Matcher {

var parsed;
try {
parsed = JSON.decode(item);
parsed = json.decode(item);
} catch (e) {
return false;
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 346ed15

Please sign in to comment.