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

Unified Diff: sdk/lib/core/uri.dart

Issue 355013002: Change new Uri(query:"") to not add a query part. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | « no previous file | tests/co19/co19-co19.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/uri.dart
diff --git a/sdk/lib/core/uri.dart b/sdk/lib/core/uri.dart
index b31b04a6349d224747b89502d438f5e14927f93e..8529de9347eb662170169fc81209a4a3f1387779 100644
--- a/sdk/lib/core/uri.dart
+++ b/sdk/lib/core/uri.dart
@@ -488,6 +488,9 @@ class Uri {
* and joined using equal and ampersand characters. The
* percent-encoding of the keys and values encodes all characters
* except for the unreserved characters.
+ * If `query` is the empty string, it is equivalent to omitting it.
+ * To have an actual empty query part,
+ * use an empty list for `queryParameters`.
* If both `query` and `queryParameters` are omitted or `null`, the
* URI will have no query part.
*
@@ -508,6 +511,8 @@ class Uri {
scheme = _makeScheme(scheme, _stringOrNullLength(scheme));
userInfo = _makeUserInfo(userInfo, 0, _stringOrNullLength(userInfo));
host = _makeHost(host, 0, _stringOrNullLength(host), false);
+ // Special case this constructor for backwards compatibility.
Anders Johnsen 2014/06/26 11:04:32 TODO for deprecating this behavior in 2.0?
Lasse Reichstein Nielsen 2014/06/26 11:14:04 I'll put it on my list, but we are not putting 2.0
+ if (query == "") query = null;
query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters);
fragment = _makeFragment(fragment, 0, _stringOrNullLength(fragment));
port = _makePort(port, scheme);
« no previous file with comments | « no previous file | tests/co19/co19-co19.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698