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

Unified Diff: packages/dart_style/test/regression/0300/0370.stmt

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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
Index: packages/dart_style/test/regression/0300/0370.stmt
diff --git a/packages/dart_style/test/regression/0300/0370.stmt b/packages/dart_style/test/regression/0300/0370.stmt
new file mode 100644
index 0000000000000000000000000000000000000000..086bbf8f9904207c64a02a015a43bbb4ee6cd811
--- /dev/null
+++ b/packages/dart_style/test/regression/0300/0370.stmt
@@ -0,0 +1,70 @@
+>>>
+return environment.barback.getAssetById(id).then((result) {
+ return result;
+}).then((asset) => _serveAsset(request, asset)).catchError(
+ (error,
+ trace) {
+ if (error is! AssetNotFoundException) throw error;
+ return environment.barback
+ .getAssetById(id.addExtension("/index.html"))
+ .then((asset) {
+ if (request.url.path.endsWith('/')) return _serveAsset(request, asset);
+
+ // We only want to serve index.html if the URL explicitly ends in a
+ // slash. For other URLs, we redirect to one with the slash added to
+ // implicitly support that too. This follows Apache's behavior.
+ logRequest(request, "302 Redirect to ${request.url}/");
+ return new shelf.Response.found('${request.url}/');
+ }).catchError((newError, newTrace) {
+ // If we find neither the original file or the index, we should report
+ // the error about the original to the user.
+ throw newError is AssetNotFoundException ? error : newError;
+ });
+}).catchError(
+ (error,
+ trace) {
+ if (error is! AssetNotFoundException) {
+ trace = new Chain.forTrace(trace);
+ logRequest(request, "$error\n$trace");
+
+ addError(error, trace);
+ close();
+ return new shelf.Response.internalServerError();
+ }
+
+ addResult(new BarbackServerResult._failure(request.url, id, error));
+ return notFound(request, asset: id);
+});
+<<<
+return environment.barback.getAssetById(id).then((result) {
+ return result;
+}).then((asset) => _serveAsset(request, asset)).catchError((error, trace) {
+ if (error is! AssetNotFoundException) throw error;
+ return environment.barback
+ .getAssetById(id.addExtension("/index.html"))
+ .then((asset) {
+ if (request.url.path.endsWith('/')) return _serveAsset(request, asset);
+
+ // We only want to serve index.html if the URL explicitly ends in a
+ // slash. For other URLs, we redirect to one with the slash added to
+ // implicitly support that too. This follows Apache's behavior.
+ logRequest(request, "302 Redirect to ${request.url}/");
+ return new shelf.Response.found('${request.url}/');
+ }).catchError((newError, newTrace) {
+ // If we find neither the original file or the index, we should report
+ // the error about the original to the user.
+ throw newError is AssetNotFoundException ? error : newError;
+ });
+}).catchError((error, trace) {
+ if (error is! AssetNotFoundException) {
+ trace = new Chain.forTrace(trace);
+ logRequest(request, "$error\n$trace");
+
+ addError(error, trace);
+ close();
+ return new shelf.Response.internalServerError();
+ }
+
+ addResult(new BarbackServerResult._failure(request.url, id, error));
+ return notFound(request, asset: id);
+});
« no previous file with comments | « packages/dart_style/test/regression/0300/0369.stmt ('k') | packages/dart_style/test/regression/0300/0374.stmt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698