Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Ported t/cookie.t from Plack::Test to P::T::Agent.

  • Loading branch information...
commit c8911650d502e58bef91969528688b6181bab6c8 1 parent 8901e2c
chromatic authored
17  lib/Plack/Test/Agent.pm
@@ -23,11 +23,24 @@ sub new
23 23
 sub get
24 24
 {
25 25
     my ($self, $uri) = @_;
26  
-    my $req          = HTTP::Request->new( GET => $uri );
  26
+    my $req          = HTTP::Request->new( GET => $self->normalize_uri($uri) );
27 27
     my $env          = $req->to_psgi;
28 28
     my $app          = $self->app;
  29
+    my $res          = HTTP::Response->from_psgi( $app->( $env ) );
29 30
 
30  
-    return HTTP::Response->from_psgi( $app->( $env ) );
  31
+    $res->request( $req );
  32
+    return $res;
  33
+}
  34
+
  35
+sub normalize_uri
  36
+{
  37
+    my ($self, $uri) = @_;
  38
+    my $normalized   = URI->new( $uri );
  39
+
  40
+    $normalized->scheme( 'http' )      unless $normalized->scheme;
  41
+    $normalized->host(   'localhost' ) unless $normalized->host;
  42
+
  43
+    return $normalized;
31 44
 }
32 45
 
33 46
 1;
35  t/cookie.t
... ...
@@ -0,0 +1,35 @@

0 notes on commit c891165

Please sign in to comment.
Something went wrong with that request. Please try again.