Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: lib/src/http_date.dart

Issue 1046573002: pkg/http_parser: format code, prepare for +6 release (Closed) Base URL: https://github.com/dart-lang/http_parser.git@master
Patch Set: cl feedback Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/bytes_builder.dart ('k') | lib/src/media_type.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/http_date.dart
diff --git a/lib/src/http_date.dart b/lib/src/http_date.dart
index 0626c72e2135abc252510248857da0ab873c590d..7d46d553eda30676d2916fd17f68c06c46beb70b 100644
--- a/lib/src/http_date.dart
+++ b/lib/src/http_date.dart
@@ -24,21 +24,21 @@ final _digitRegExp = new RegExp(r"\d+");
String formatHttpDate(DateTime date) {
date = date.toUtc();
var buffer = new StringBuffer()
- ..write(_WEEKDAYS[date.weekday - 1])
- ..write(", ")
- ..write(date.day <= 9 ? "0" : "")
- ..write(date.day.toString())
- ..write(" ")
- ..write(_MONTHS[date.month - 1])
- ..write(" ")
- ..write(date.year.toString())
- ..write(date.hour <= 9 ? " 0" : " ")
- ..write(date.hour.toString())
- ..write(date.minute <= 9 ? ":0" : ":")
- ..write(date.minute.toString())
- ..write(date.second <= 9 ? ":0" : ":")
- ..write(date.second.toString())
- ..write(" GMT");
+ ..write(_WEEKDAYS[date.weekday - 1])
+ ..write(", ")
+ ..write(date.day <= 9 ? "0" : "")
+ ..write(date.day.toString())
+ ..write(" ")
+ ..write(_MONTHS[date.month - 1])
+ ..write(" ")
+ ..write(date.year.toString())
+ ..write(date.hour <= 9 ? " 0" : " ")
+ ..write(date.hour.toString())
+ ..write(date.minute <= 9 ? ":0" : ":")
+ ..write(date.minute.toString())
+ ..write(date.second <= 9 ? ":0" : ":")
+ ..write(date.second.toString())
+ ..write(" GMT");
return buffer.toString();
}
@@ -88,9 +88,7 @@ DateTime parseHttpDate(String date) {
scanner.expect(" ");
var month = _parseMonth(scanner);
scanner.expect(" ");
- var day = scanner.scan(" ") ?
- _parseInt(scanner, 1) :
- _parseInt(scanner, 2);
+ var day = scanner.scan(" ") ? _parseInt(scanner, 1) : _parseInt(scanner, 2);
scanner.expect(" ");
var time = _parseTime(scanner);
scanner.expect(" ");
@@ -141,8 +139,8 @@ DateTime _parseTime(StringScanner scanner) {
/// Validates that [day] is a valid day for [month]. If it's not, throws a
/// [FormatException].
DateTime _makeDateTime(int year, int month, int day, DateTime time) {
- var dateTime = new DateTime.utc(
- year, month, day, time.hour, time.minute, time.second);
+ var dateTime =
+ new DateTime.utc(year, month, day, time.hour, time.minute, time.second);
// If [day] was too large, it will cause [month] to overflow.
if (dateTime.month != month) {
« no previous file with comments | « lib/src/bytes_builder.dart ('k') | lib/src/media_type.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698