Fix auth bug exposed by t/multi_content_type.t
Ash Berlin [Mon, 2 Feb 2009 22:37:44 +0000 (22:37 +0000)]
lib/Test/WWW/Mechanize/Catalyst.pm
t/multi_content_type.t

index 1230a45..da48764 100644 (file)
@@ -28,8 +28,13 @@ sub _make_request {
             return $self->SUPER::_make_request($request);
         }
     }
-
-    my @creds = $self->get_basic_credentials( "Basic", $request->uri );
+  
+    my $uri = $request->uri;
+    if ($uri->as_string =~ m{^/}) {
+      $uri->scheme('http');
+      $uri->host('localhost');
+    }
+    my @creds = $self->get_basic_credentials( "Basic", $uri );
     $request->authorization_basic( @creds ) if @creds;
 
     my $response = Test::WWW::Mechanize::Catalyst::Aux::request($request);
index 2748ebc..5805b6d 100644 (file)
@@ -15,7 +15,7 @@ use Test::Exception;
 
 BEGIN {
     diag(
-        "###################################################################\n",
+        "\n###################################################################\n",
         "Starting an external Catalyst HTTP server on port $PORT\n",
         "To change the port, please set the TWMC_TEST_PORT env variable.\n",
         "(The server will be automatically shut-down right after the tests).\n",