Chromium Code Reviews

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/barback_server.dart

Issue 786223006: Support cross-origin requests to pub serve. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/serve/supports_cross_origin_header_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/barback/barback_server.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/barback_server.dart b/sdk/lib/_internal/pub/lib/src/barback/barback_server.dart
index 2f1b4f8e350f0d93c9dfad1c2448a0d7ea5dc07e..f825bd853240a1e4e746bbec31e7552d3fcee567 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/barback_server.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/barback_server.dart
@@ -143,6 +143,13 @@ class BarbackServer extends BaseServer<BarbackServerResult> {
addResult(new BarbackServerResult._failure(request.url, id, error));
return notFound(request, asset: id);
+ }).then((response) {
+ // Allow requests of any origin to access "pub serve". This is useful for
+ // running "pub serve" in parallel with another development server. Since
+ // "pub serve" is only used as a development server and doesn't require
+ // any sort of credentials anyway, this is secure.
+ return response.change(
+ headers: const {"Access-Control-Allow-Origin": "*"});
});
}
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/serve/supports_cross_origin_header_test.dart » ('j') | no next file with comments »

Powered by Google App Engine