fix 404 test
[Net-HTTPS-Any.git] / t / post-netssleay.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use Test::More;
6
7 BEGIN {
8   plan( tests=>4 );
9   use_ok 'Net::HTTPS::Any', 'https_post';
10 };
11
12 #200
13 my($content, $response, %headers) = https_post(
14   { 'host' => 'www.google.com',
15     'port' => 443,
16     'path' => '/accounts/ServiceLoginAuth',
17     'args' => { 'posted' => 'data' },
18   },
19   'net_https_any_test' => 1,
20 );
21
22 #like($response, qr/^HTTP\/[\d\.]+\s+200/i, 'Received 200 (OK) response');
23 like($response, qr/^200/i, 'Received 200 (OK) response');
24
25 ok( length($content), 'Received content' );
26
27 #404
28
29 my($content2, $response2, %headers2) = https_post(
30   { 'host' => 'www.google.com',
31     'port' => 443,
32     'path' => '/notfound.html',
33     'args' => { 'length' => 'required' },
34   },
35   'net_https_any_test' => 1,
36 );
37
38 #like($response2, qr/^HTTP\/[\d\.]+\s+404/i, 'Received 404 (Not Found) response');
39 like($response2, qr/^404/i, 'Received 404 (Not Found) response');
40