[Catalyst-commits] r14122 - in Test-WWW-Mechanize-Catalyst/trunk: .
lib/Test/WWW/Mechanize
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Tue Sep 27 18:19:27 GMT 2011
Author: t0m
Date: 2011-09-27 18:19:27 +0000 (Tue, 27 Sep 2011)
New Revision: 14122
Modified:
Test-WWW-Mechanize-Catalyst/trunk/CHANGES
Test-WWW-Mechanize-Catalyst/trunk/lib/Test/WWW/Mechanize/Catalyst.pm
Log:
merge branch
svn diff http://dev.catalyst.perl.org/repos/Catalyst/Test-WWW-Mechanize-Catalyst/trunk http://dev.catalyst.perl.org/repos/Catalyst/Test-WWW-Mechanize-Catalyst/branches/host_header/
Modified: Test-WWW-Mechanize-Catalyst/trunk/CHANGES
===================================================================
--- Test-WWW-Mechanize-Catalyst/trunk/CHANGES 2011-09-27 18:12:35 UTC (rev 14121)
+++ Test-WWW-Mechanize-Catalyst/trunk/CHANGES 2011-09-27 18:19:27 UTC (rev 14122)
@@ -1,5 +1,8 @@
Revision history for Perl module Test::WWW::Mechanize::Catalyst:
+0.55
+ - Set 'Host' header for remote requests too
+
0.54 Mon Aug 1 20:49 BST 2011
- change to make sure we support changes in Catalyst::Test introduced
in the Cataplack port.
Modified: Test-WWW-Mechanize-Catalyst/trunk/lib/Test/WWW/Mechanize/Catalyst.pm
===================================================================
--- Test-WWW-Mechanize-Catalyst/trunk/lib/Test/WWW/Mechanize/Catalyst.pm 2011-09-27 18:12:35 UTC (rev 14121)
+++ Test-WWW-Mechanize-Catalyst/trunk/lib/Test/WWW/Mechanize/Catalyst.pm 2011-09-27 18:19:27 UTC (rev 14122)
@@ -12,7 +12,7 @@
#use namespace::clean -execept => 'meta';
-our $VERSION = '0.54';
+our $VERSION = '0.55';
our $APP_CLASS;
my $Test = Test::Builder->new();
@@ -126,6 +126,17 @@
return $response;
}
+sub _set_host_header {
+ my ( $self, $request ) = @_;
+ # If there's no Host header, set one.
+ unless ($request->header('Host')) {
+ my $host = $self->has_host
+ ? $self->host
+ : $request->uri->host;
+ $request->header('Host', $host);
+ }
+}
+
sub _do_catalyst_request {
my ($self, $request) = @_;
@@ -140,15 +151,8 @@
return $self->_do_remote_request($request)
if $ENV{CATALYST_SERVER};
- # If there's no Host header, set one.
- unless ($request->header('Host')) {
- my $host = $self->has_host
- ? $self->host
- : $uri->host;
+ $self->_set_host_header($request);
- $request->header('Host', $host);
- }
-
my $res = $self->_check_external_request($request);
return $res if $res;
@@ -219,6 +223,7 @@
$request->uri->host( $server->host );
$request->uri->port( $server->port );
$request->uri->path( $server->path . $request->uri->path );
+ $self->_set_host_header($request);
return $self->SUPER::_make_request($request);
}
More information about the Catalyst-commits
mailing list