| 1 |
use Test::More tests => 8; |
| 2 |
use strict; |
| 3 |
use utf8; |
| 4 |
|
| 5 |
use SOAP::WSDL::Transport::HTTP; |
| 6 |
|
| 7 |
my $transport = SOAP::WSDL::Transport::HTTP->new(); |
| 8 |
|
| 9 |
ok $transport->is_success(1); |
| 10 |
ok $transport->code(200); |
| 11 |
ok $transport->status('200 OK'); |
| 12 |
ok $transport->message('OK'); |
| 13 |
|
| 14 |
my $result = $transport->send_receive(envelope => 'Test', action => 'foo'); |
| 15 |
|
| 16 |
ok ! $transport->is_success(); |
| 17 |
|
| 18 |
$result = $transport->send_receive(encoding => 'utf-8', envelope => 'ÄÖÜ', |
| 19 |
action => 'foo'); |
| 20 |
ok ! $transport->is_success(); |
| 21 |
|
| 22 |
$result = $transport->send_receive(encoding => 'utf-8', envelope => 'ÄÖÜ', |
| 23 |
action => 'foo', content_type => 'application/xml'); |
| 24 |
ok ! $transport->is_success(); |
| 25 |
|
| 26 |
{ |
| 27 |
no warnings qw(redefine); |
| 28 |
my $request_sub =\&LWP::UserAgent::request; |
| 29 |
*LWP::UserAgent::request = sub { |
| 30 |
my $self = shift; |
| 31 |
my $request = shift; |
| 32 |
is $request->header('Content-Type'), 'text/xml; charset=utf-8'; |
| 33 |
return HTTP::Response->new( 200 ); |
| 34 |
}; |
| 35 |
|
| 36 |
$result = $transport->send_receive(envelope => 'Test', action => 'foo'); |
| 37 |
*LWP::UserAgent::request = $request_sub; |
| 38 |
} |