Permalink
Browse files

host名がすでにセットされている場合localhostで上書きしない

  • Loading branch information...
typester committed Jun 15, 2012
1 parent 190d8a4 commit 267262414cf3baef839b7c600b094bdb8c1c8be8
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/Ark/Test.pm
View
@@ -71,8 +71,10 @@ sub import {
my $req = ref($_[0]) eq 'HTTP::Request' ? $_[0] : HTTP::Request->new(@_);
if ($cookie) {
- $req->uri( URI->new('http://localhost' . $req->uri->path_query ) );
- $req->header( Host => 'localhost' );
+ unless ($req->uri->can('host') and $req->uri->host) {
+ $req->uri( URI->new('http://localhost' . $req->uri->path_query ) );
+ $req->header( Host => 'localhost' );
+ }
$cookie->add_cookie_header($req) unless $req->header('Cookie');
}

0 comments on commit 2672624

Please sign in to comment.