From: Hans Dieter Pearcey Date: Tue, 28 Apr 2009 17:00:38 +0000 (+0000) Subject: kill CONTENT_TYPE too X-Git-Tag: 0.030~36 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-WrapCGI.git;a=commitdiff_plain;h=a032b7f8e3075e9c44f33d4a1e728fac48c5a0e2 kill CONTENT_TYPE too --- diff --git a/lib/Catalyst/Controller/WrapCGI.pm b/lib/Catalyst/Controller/WrapCGI.pm index 415bf3e..5055a9c 100644 --- a/lib/Catalyst/Controller/WrapCGI.pm +++ b/lib/Catalyst/Controller/WrapCGI.pm @@ -76,8 +76,9 @@ variables or regular expressions to remove from the environment before passing it to your CGIs. Entries surrounded by C characters are considered regular expressions. -Default is to pass the whole of C<%ENV>, except for C (that is, the -default C is C<[ 'MOD_PERL' ]>. +Default is to pass the whole of C<%ENV>, except for C and +C (that is, the default C is C<[ qw(MOD_PERL +CONTENT_TYPE) ]>. C<< $your_controller->{CGI}{username_field} >> should be the field for your user's name, which will be read from C<< $c->user->obj >>. Defaults to 'username'. @@ -217,7 +218,7 @@ sub _filtered_env { $pass_env = [ $pass_env ] unless ref $pass_env; my $kill_env = $self->{CGI}{kill_env}; - $kill_env = [ 'MOD_PERL' ] unless defined $kill_env; + $kill_env = [ 'MOD_PERL', 'CONTENT_TYPE' ] unless defined $kill_env; $kill_env = [ $kill_env ] unless ref $kill_env; if (@$pass_env) { diff --git a/t/lib/TestApp/Controller/Root.pm b/t/lib/TestApp/Controller/Root.pm index c1729e7..054f561 100644 --- a/t/lib/TestApp/Controller/Root.pm +++ b/t/lib/TestApp/Controller/Root.pm @@ -8,7 +8,7 @@ __PACKAGE__->config->{namespace} = ''; my $cgi = sub { my $cgi = CGI->new; print $cgi->header; - print 'foo:',$cgi->param('foo'),' bar:',$cgi->param('bar') + print 'foo:',$cgi->param('foo'),' bar:',$cgi->param('bar'); }; sub handle_cgi : Path('/cgi-bin/test.cgi') { diff --git a/t/wrap-cgi.t b/t/wrap-cgi.t index 8e01df7..6a49d59 100644 --- a/t/wrap-cgi.t +++ b/t/wrap-cgi.t @@ -6,7 +6,7 @@ use warnings; use FindBin '$Bin'; use lib "$Bin/lib"; -use Test::More tests => 4; +use Test::More tests => 5; use Catalyst::Test 'TestApp'; use HTTP::Request::Common; @@ -18,6 +18,13 @@ my $response = request POST '/cgi-bin/test.cgi', [ is($response->content, 'foo:bar bar:baz', 'POST to CGI'); +$response = request POST '/cgi-bin/test.cgi', [ + foo => 'bar', + bar => 'baz', +], 'Content-Type' => 'form-data'; + +is($response->content, 'foo:bar bar:baz', 'POST to CGI (form-data)'); + $response = request '/cgi-bin/test_pathinfo.cgi/path/%2Finfo'; is($response->content, '/path/%2Finfo', 'PATH_INFO is correct');