Add a paragraph to summarize the motivation for releases since 5.815
[libwww-perl-eserte.git] / t / net / http-post.t
blob161ed5d0615a1e1e7aa181ecb640a74babb78ec3
1 #!/usr/local/bin/perl -w
3 # Check POST via HTTP.
6 print "1..2\n";
8 require "net/config.pl";
9 require LWP::Protocol::http;
10 require LWP::UserAgent;
12 $netloc = $net::httpserver;
13 $script = $net::cgidir . "/test";
15 my $ua = new LWP::UserAgent; # create a useragent to test
17 $url = new URI::URL("http://$netloc$script");
19 my $form = 'searchtype=Substring';
21 my $request = new HTTP::Request('POST', $url, undef, $form);
22 $request->header('Content-Type', 'application/x-www-form-urlencoded');
24 my $response = $ua->request($request, undef, undef);
26 my $str = $response->as_string;
28 print "$str\n";
30 if ($response->is_success and $str =~ /^REQUEST_METHOD=POST$/m) {
31 print "ok 1\n";
33 else {
34 print "not ok 1\n";
37 if ($str =~ /^CONTENT_LENGTH=(\d+)$/m && $1 == length($form)) {
38 print "ok 2\n";
40 else {
41 print "not ok 2\n";
44 # avoid -w warning
45 $dummy = $net::httpserver;
46 $dummy = $net::cgidir;