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
39
40
|
#!/usr/bin/perl
use strict;
use warnings;
use Test::More;
BEGIN {
plan( tests=>4 );
use_ok 'Net::HTTPS::Any', 'https_post';
};
#200
my($content, $response, %headers) = https_post(
{ 'host' => 'www.google.com',
'port' => 443,
'path' => '/accounts/ServiceLoginAuth',
'args' => { 'posted' => 'data' },
},
'net_https_any_test' => 1,
);
#like($response, qr/^HTTP\/[\d\.]+\s+200/i, 'Received 200 (OK) response');
like($response, qr/^200/i, 'Received 200 (OK) response');
ok( length($content), 'Received content' );
#404
my($content2, $response2, %headers2) = https_post(
{ 'host' => 'www.google.com',
'port' => 443,
'path' => '/notfound.html',
'args' => { 'length' => 'required' },
},
'net_https_any_test' => 1,
);
#like($response2, qr/^HTTP\/[\d\.]+\s+404/i, 'Received 404 (Not Found) response');
like($response2, qr/^404/i, 'Received 404 (Not Found) response');
|