Skip to content

Commit 5f0d557

Browse files
committed
Updated more constant names.
1 parent 346ed15 commit 5f0d557

File tree

11 files changed

+41
-41
lines changed

11 files changed

+41
-41
lines changed

lib/http.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Future<Response> get(url, {Map<String, String> headers}) =>
6161
/// content-type of the request will be set to
6262
/// `"application/x-www-form-urlencoded"`; this cannot be overridden.
6363
///
64-
/// [encoding] defaults to [UTF8].
64+
/// [encoding] defaults to [utf8].
6565
///
6666
/// For more fine-grained control over the request, use [Request] or
6767
/// [StreamedRequest] instead.
@@ -85,7 +85,7 @@ Future<Response> post(url, {Map<String, String> headers, body,
8585
/// content-type of the request will be set to
8686
/// `"application/x-www-form-urlencoded"`; this cannot be overridden.
8787
///
88-
/// [encoding] defaults to [UTF8].
88+
/// [encoding] defaults to [utf8].
8989
///
9090
/// For more fine-grained control over the request, use [Request] or
9191
/// [StreamedRequest] instead.
@@ -109,7 +109,7 @@ Future<Response> put(url, {Map<String, String> headers, body,
109109
/// content-type of the request will be set to
110110
/// `"application/x-www-form-urlencoded"`; this cannot be overridden.
111111
///
112-
/// [encoding] defaults to [UTF8].
112+
/// [encoding] defaults to [utf8].
113113
///
114114
/// For more fine-grained control over the request, use [Request] or
115115
/// [StreamedRequest] instead.

lib/src/byte_stream.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class ByteStream extends StreamView<List<int>> {
2828

2929
/// Collect the data of this stream in a [String], decoded according to
3030
/// [encoding], which defaults to `UTF8`.
31-
Future<String> bytesToString([Encoding encoding=UTF8]) =>
31+
Future<String> bytesToString([Encoding encoding=utf8]) =>
3232
encoding.decodeStream(this);
3333

34-
Stream<String> toStringStream([Encoding encoding=UTF8]) =>
34+
Stream<String> toStringStream([Encoding encoding=utf8]) =>
3535
encoding.decoder.bind(this);
3636
}

lib/src/client.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ abstract class Client {
5656
/// content-type of the request will be set to
5757
/// `"application/x-www-form-urlencoded"`; this cannot be overridden.
5858
///
59-
/// [encoding] defaults to [UTF8].
59+
/// [encoding] defaults to [utf8].
6060
///
6161
/// For more fine-grained control over the request, use [send] instead.
6262
Future<Response> post(url, {Map<String, String> headers, body,
@@ -77,7 +77,7 @@ abstract class Client {
7777
/// content-type of the request will be set to
7878
/// `"application/x-www-form-urlencoded"`; this cannot be overridden.
7979
///
80-
/// [encoding] defaults to [UTF8].
80+
/// [encoding] defaults to [utf8].
8181
///
8282
/// For more fine-grained control over the request, use [send] instead.
8383
Future<Response> put(url, {Map<String, String> headers, body,
@@ -98,7 +98,7 @@ abstract class Client {
9898
/// content-type of the request will be set to
9999
/// `"application/x-www-form-urlencoded"`; this cannot be overridden.
100100
///
101-
/// [encoding] defaults to [UTF8].
101+
/// [encoding] defaults to [utf8].
102102
///
103103
/// For more fine-grained control over the request, use [send] instead.
104104
Future<Response> patch(url, {Map<String, String> headers, body,

lib/src/multipart_file.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class MultipartFile {
7070
{String filename, MediaType contentType}) {
7171
contentType = contentType == null ? new MediaType("text", "plain")
7272
: contentType;
73-
var encoding = encodingForCharset(contentType.parameters['charset'], UTF8);
73+
var encoding = encodingForCharset(contentType.parameters['charset'], utf8);
7474
contentType = contentType.change(parameters: {'charset': encoding.name});
7575

7676
return new MultipartFile.fromBytes(field, encoding.encode(value),

lib/src/request.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Request extends BaseRequest {
3636
/// If the request has a `Content-Type` header and that header has a `charset`
3737
/// parameter, that parameter's value is used as the encoding. Otherwise, if
3838
/// [encoding] has been set manually, that encoding is used. If that hasn't
39-
/// been set either, this defaults to [UTF8].
39+
/// been set either, this defaults to [utf8].
4040
///
4141
/// If the `charset` parameter's value is not a known [Encoding], reading this
4242
/// will throw a [FormatException].
@@ -130,7 +130,7 @@ class Request extends BaseRequest {
130130

131131
/// Creates a new HTTP request.
132132
Request(String method, Uri url)
133-
: _defaultEncoding = UTF8,
133+
: _defaultEncoding = utf8,
134134
_bodyBytes = new Uint8List(0),
135135
super(method, url);
136136

lib/src/response.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Response extends BaseResponse {
2121
/// The body of the response as a string. This is converted from [bodyBytes]
2222
/// using the `charset` parameter of the `Content-Type` header field, if
2323
/// available. If it's unavailable or if the encoding name is unknown,
24-
/// [LATIN1] is used by default, as per [RFC 2616][].
24+
/// [latin1] is used by default, as per [RFC 2616][].
2525
///
2626
/// [RFC 2616]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html
2727
String get body => _encodingForHeaders(headers).decode(bodyBytes);
@@ -80,7 +80,7 @@ class Response extends BaseResponse {
8080
}
8181

8282
/// Returns the encoding to use for a response with the given headers. This
83-
/// defaults to [LATIN1] if the headers don't specify a charset or
83+
/// defaults to [latin1] if the headers don't specify a charset or
8484
/// if that charset is unknown.
8585
Encoding _encodingForHeaders(Map<String, String> headers) =>
8686
encodingForCharset(_contentTypeForHeaders(headers).parameters['charset']);

lib/src/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ List<String> split1(String toSplit, String pattern) {
4040
/// Returns the [Encoding] that corresponds to [charset]. Returns [fallback] if
4141
/// [charset] is null or if no [Encoding] was found that corresponds to
4242
/// [charset].
43-
Encoding encodingForCharset(String charset, [Encoding fallback = LATIN1]) {
43+
Encoding encodingForCharset(String charset, [Encoding fallback = latin1]) {
4444
if (charset == null) return fallback;
4545
var encoding = Encoding.getByName(charset);
4646
return encoding == null ? fallback : encoding;

test/io/client_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ void main() {
1616
expect(startServer().then((_) {
1717
var client = new http.Client();
1818
var request = new http.StreamedRequest("POST", serverUrl);
19-
request.headers[HttpHeaders.CONTENT_TYPE] =
19+
request.headers[HttpHeaders.contentType] =
2020
'application/json; charset=utf-8';
21-
request.headers[HttpHeaders.USER_AGENT] = 'Dart';
21+
request.headers[HttpHeaders.userAgent] = 'Dart';
2222

2323
expect(client.send(request).then((response) {
2424
expect(response.request, equals(request));
@@ -51,9 +51,9 @@ void main() {
5151
var ioClient = new HttpClient();
5252
var client = new http.IOClient(ioClient);
5353
var request = new http.StreamedRequest("POST", serverUrl);
54-
request.headers[HttpHeaders.CONTENT_TYPE] =
54+
request.headers[HttpHeaders.contentType] =
5555
'application/json; charset=utf-8';
56-
request.headers[HttpHeaders.USER_AGENT] = 'Dart';
56+
request.headers[HttpHeaders.userAgent] = 'Dart';
5757

5858
expect(client.send(request).then((response) {
5959
expect(response.request, equals(request));
@@ -86,7 +86,7 @@ void main() {
8686
var client = new http.Client();
8787
var url = Uri.parse('http://http.invalid');
8888
var request = new http.StreamedRequest("POST", url);
89-
request.headers[HttpHeaders.CONTENT_TYPE] =
89+
request.headers[HttpHeaders.contentType] =
9090
'application/json; charset=utf-8';
9191

9292
expect(client.send(request), throwsSocketException);

test/io/streamed_request_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void main() {
2020

2121
return request.send();
2222
}).then((response) {
23-
expect(UTF8.decodeStream(response.stream),
23+
expect(utf8.decodeStream(response.stream),
2424
completion(parse(containsPair('headers',
2525
containsPair('content-length', ['10'])))));
2626
}).whenComplete(stopServer);
@@ -34,7 +34,7 @@ void main() {
3434

3535
return request.send();
3636
}).then((response) {
37-
expect(UTF8.decodeStream(response.stream),
37+
expect(utf8.decodeStream(response.stream),
3838
completion(parse(containsPair('headers',
3939
isNot(contains('content-length'))))));
4040
}).whenComplete(stopServer);
@@ -49,7 +49,7 @@ void main() {
4949
request.sink.close();
5050
return request.send();
5151
}).then((response) {
52-
expect(UTF8.decodeStream(response.stream), completion(equals('body')));
52+
expect(utf8.decodeStream(response.stream), completion(equals('body')));
5353
}).whenComplete(stopServer);
5454
});
5555

test/io/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Future startServer() {
6565
if (encodingName != null) {
6666
outputEncoding = requiredEncodingForCharset(encodingName);
6767
} else {
68-
outputEncoding = ASCII;
68+
outputEncoding = ascii;
6969
}
7070

7171
response.headers.contentType =

0 commit comments

Comments
 (0)