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

Unified Diff: pkg/http_server/test/utils.dart

Issue 119453005: Make VirtualDirectory redirect if the directory-path does not end with a tailing slash. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Using relative Uri for now. Created 6 years, 11 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 | « pkg/http_server/lib/src/virtual_directory.dart ('k') | pkg/http_server/test/virtual_directory_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http_server/test/utils.dart
diff --git a/pkg/http_server/test/utils.dart b/pkg/http_server/test/utils.dart
index d9e67a8daefa79fd58b03605775775112ac55e99..898cf31e1ecea9cb1b4529c918ccf3b189177257 100644
--- a/pkg/http_server/test/utils.dart
+++ b/pkg/http_server/test/utils.dart
@@ -27,12 +27,14 @@ Future<int> getStatusCodeForVirtDir(VirtualDirectory virtualDir,
{String host,
bool secure: false,
DateTime ifModifiedSince,
- bool rawPath: false}) {
+ bool rawPath: false,
+ bool followRedirects: true}) {
return _withServer((server) {
virtualDir.serve(server);
return getStatusCode(server.port, path, host: host, secure: secure,
- ifModifiedSince: ifModifiedSince, rawPath: rawPath);
+ ifModifiedSince: ifModifiedSince, rawPath: rawPath,
+ followRedirects: followRedirects);
});
}
@@ -41,7 +43,8 @@ Future<int> getStatusCode(int port,
{String host,
bool secure: false,
DateTime ifModifiedSince,
- bool rawPath: false}) {
+ bool rawPath: false,
+ bool followRedirects: true}) {
Uri uri;
if (rawPath) {
uri = new Uri(scheme: secure ? 'https' : 'http',
@@ -56,6 +59,7 @@ Future<int> getStatusCode(int port,
return new HttpClient().getUrl(uri)
.then((request) {
+ if (!followRedirects) request.followRedirects = false;
if (host != null) request.headers.host = host;
if (ifModifiedSince != null) {
request.headers.ifModifiedSince = ifModifiedSince;
« no previous file with comments | « pkg/http_server/lib/src/virtual_directory.dart ('k') | pkg/http_server/test/virtual_directory_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698