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

Unified Diff: lib/src/utils.dart

Issue 1290763003: Drop support for old SDK and shelf versions. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 4 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/util/path_handler.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index 41211f335aff7ea90945d06b46c7e354799965c5..7793d3084deaa94f9493ecd1f7b64039ea32b181 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -396,42 +396,6 @@ String randomBase64(int bytes, {int seed, bool urlSafe: false,
urlSafe: urlSafe, addLineSeparator: addLineSeparator);
}
-// TODO(nweiz): Remove this and [shelfChange] once Shelf 0.6.0 has been out for
-// six months or so.
-/// Returns `request.url` in a cross-version way.
-///
-/// This follows the semantics of Shelf 0.6.x, even when using Shelf 0.5.x: the
-/// returned URL never starts with "/".
-Uri shelfUrl(shelf.Request request) {
- var url = request.url;
- if (!url.path.startsWith("/")) return url;
- return url.replace(path: url.path.replaceFirst("/", ""));
-}
-
-/// Like [shelf.Request.change], but cross-version.
-///
-/// This follows the semantics of Shelf 0.6.x, even when using Shelf 0.5.x.
-shelf.Request shelfChange(shelf.Request typedRequest, {String path}) {
- // Explicitly make the request dynamic since we're calling methods here that
- // aren't defined in all support Shelf versions, and we don't want the
- // analyzer to complain.
- var request = typedRequest as dynamic;
-
- try {
- return request.change(path: path);
- } on NoSuchMethodError catch (_) {
- var newScriptName = p.url.join(request.scriptName, path);
- if (request.scriptName.isEmpty) newScriptName = "/" + newScriptName;
-
- var newUrlPath = p.url.relative(request.url.path.replaceFirst("/", ""),
- from: path);
- newUrlPath = newUrlPath == "." ? "" : "/" + newUrlPath;
-
- return request.change(
- scriptName: newScriptName, url: request.url.replace(path: newUrlPath));
- }
-}
-
/// Returns middleware that nests all requests beneath the URL prefix [beneath].
shelf.Middleware nestingMiddleware(String beneath) {
return (handler) {
« no previous file with comments | « lib/src/util/path_handler.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698