Index: t/PostApp.t
===================================================================
--- t/PostApp.t (revision 10465)
+++ t/PostApp.t (working copy)
@@ -1,8 +1,9 @@
+use strict;
+use warnings;
use Test::More tests => 16;
-use File::Spec::Functions;
-use HTTP::Response;
-use IPC::Open3;
-use Symbol;
+use lib 't/PostApp/lib';
+use Catalyst::Test 'PostApp';
+use HTTP::Request::Common;
my $response;
@@ -152,33 +153,10 @@
my $path = shift;
my $content = shift;
- local %ENV = %ENV;
- $ENV{REMOTE_ADDR} ='127.0.0.1';
- $ENV{CONTENT_LENGTH} = length $content;
- $ENV{CONTENT_TYPE} ='application/soap+xml';
- $ENV{SCRIPT_NAME} = $path;
- $ENV{QUERY_STRING} = '';
- $ENV{CATALYST_DEBUG} = 1;
- $ENV{REQUEST_METHOD} ='POST';
- $ENV{SERVER_PORT} ='80';
- $ENV{SERVER_NAME} ='pitombeira';
- $ENV{HTTP_SOAPAction} = '
http://example.com/actions/Greet';
-
- my ($writer, $reader, $error) = map { gensym() } 1..3;
- my $pid = open3($writer, $reader, $error,
- $^X, (map { '-I'.$_ } @INC),
- catfile(qw(t PostApp script postapp_cgi.pl)));
-
- print {$writer} $content;
- close $content;
-
- my $response_str = join '', <$reader>;
- map { warn '# '.$_ } <$error>;
-
- close $reader;
- close $error;
- waitpid $pid, 0;
- return HTTP::Response->parse($response_str);
+ return request POST $path,
+ Content => $content,
+ Content_Type => 'application/soap+xml',
+ SOAPAction => '
http://example.com/actions/Greet';
}
1;
Index: lib/Catalyst/Action/SOAP.pm
===================================================================
--- lib/Catalyst/Action/SOAP.pm (revision 10465)
+++ lib/Catalyst/Action/SOAP.pm (working copy)
@@ -24,7 +24,7 @@
$c->req->method eq 'POST') {
my $body = $c->req->body;
my $xml_str = ref $body ? (join '', <$body>) : $body;
- $c->log->debug("Incoming XML: $xml_str");
+ $c->log->debug("Incoming XML: $xml_str") if $c->debug;
eval {
$c->stash->{soap}->envelope($xml_str);
$c->stash->{soap}->parsed_envelope($self->xml_parser->parse_string($xml_str));