File: HTTP.t

package info (click to toggle)
libsoap-wsdl-perl 3.004-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,600 kB
  • sloc: perl: 8,433; xml: 1,769; java: 19; makefile: 15
file content (38 lines) | stat: -rw-r--r-- 1,084 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use Test::More tests => 8;
use strict;
use utf8;

use SOAP::WSDL::Transport::HTTP;

my $transport = SOAP::WSDL::Transport::HTTP->new();

ok $transport->is_success(1);
ok $transport->code(200);
ok $transport->status('200 OK');
ok $transport->message('OK');

my $result = $transport->send_receive(envelope => 'Test', action => 'foo');

ok ! $transport->is_success();

$result = $transport->send_receive(encoding => 'utf-8', envelope => 'ÄÖÜ',
    action => 'foo');
ok ! $transport->is_success();

$result = $transport->send_receive(encoding => 'utf-8', envelope => 'ÄÖÜ',
    action => 'foo', content_type => 'application/xml');
ok ! $transport->is_success();

{
    no warnings qw(redefine);
    my $request_sub =\&LWP::UserAgent::request;
    *LWP::UserAgent::request = sub {
        my $self = shift;
        my $request = shift;
        is $request->header('Content-Type'), 'text/xml; charset=utf-8';
        return HTTP::Response->new( 200 );
    };

    $result = $transport->send_receive(envelope => 'Test', action => 'foo');
    *LWP::UserAgent::request = $request_sub;
}