Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A parsed URI, such as a URL. | 8 * A parsed URI, such as a URL. |
| 9 * | 9 * |
| 10 * **See also:** | 10 * **See also:** |
| (...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1375 static String _normalizePath(String path, String scheme, bool hasAuthority) { | 1375 static String _normalizePath(String path, String scheme, bool hasAuthority) { |
| 1376 if (scheme.isEmpty && !hasAuthority && !path.startsWith('/')) { | 1376 if (scheme.isEmpty && !hasAuthority && !path.startsWith('/')) { |
| 1377 return _normalizeRelativePath(path); | 1377 return _normalizeRelativePath(path); |
| 1378 } | 1378 } |
| 1379 return _removeDotSegments(path); | 1379 return _removeDotSegments(path); |
| 1380 } | 1380 } |
| 1381 | 1381 |
| 1382 static String _makeQuery( | 1382 static String _makeQuery( |
| 1383 String query, int start, int end, | 1383 String query, int start, int end, |
| 1384 Map<String, dynamic/*String|Iterable<String>*/> queryParameters) { | 1384 Map<String, dynamic/*String|Iterable<String>*/> queryParameters) { |
| 1385 if (query == null && queryParameters == null) return null; | |
| 1386 if (query != null && queryParameters != null) { | 1385 if (query != null && queryParameters != null) { |
| 1387 throw new ArgumentError('Both query and queryParameters specified'); | 1386 throw new ArgumentError('Both query and queryParameters specified'); |
| 1388 } | 1387 } |
| 1389 if (query != null) return _normalize(query, start, end, _queryCharTable); | 1388 if (query != null) return _normalize(query, start, end, _queryCharTable); |
|
Lasse Reichstein Nielsen
2016/08/17 10:53:12
I hate seeing `if (query != null` twice.
How about
sra1
2016/08/17 17:41:35
Done.
| |
| 1389 if (queryParameters == null) return null; | |
| 1390 | 1390 |
| 1391 var result = new StringBuffer(); | 1391 var result = new StringBuffer(); |
| 1392 var separator = ""; | 1392 var separator = ""; |
| 1393 | 1393 |
| 1394 void writeParameter(String key, String value) { | 1394 void writeParameter(String key, String value) { |
| 1395 result.write(separator); | 1395 result.write(separator); |
| 1396 separator = "&"; | 1396 separator = "&"; |
| 1397 result.write(Uri.encodeQueryComponent(key)); | 1397 result.write(Uri.encodeQueryComponent(key)); |
| 1398 if (value != null && value.isNotEmpty) { | 1398 if (value != null && value.isNotEmpty) { |
| 1399 result.write("="); | 1399 result.write("="); |
| (...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3352 // All non-escape RFC-2396 uric characters. | 3352 // All non-escape RFC-2396 uric characters. |
| 3353 // | 3353 // |
| 3354 // uric = reserved | unreserved | escaped | 3354 // uric = reserved | unreserved | escaped |
| 3355 // reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," | 3355 // reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," |
| 3356 // unreserved = alphanum | mark | 3356 // unreserved = alphanum | mark |
| 3357 // mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" | 3357 // mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" |
| 3358 // | 3358 // |
| 3359 // This is the same characters as in a URI query (which is URI pchar plus '?') | 3359 // This is the same characters as in a URI query (which is URI pchar plus '?') |
| 3360 static const _uricTable = Uri._queryCharTable; | 3360 static const _uricTable = Uri._queryCharTable; |
| 3361 } | 3361 } |
| OLD | NEW |