3 use Test::More tests => 2;
8 my $c = AnyEvent->condvar;
10 my $h = AnyEvent::HTTPD->new (port => 19090);
17 my ($httpd, $req) = @_;
18 $req_hdr = $req->{hdr}->{'content-type'};
20 content => ['text/plain', "Test response"]
27 tcp_connect '127.0.0.1', 19090, sub {
29 or die "couldn't connect: $!";
32 AnyEvent::Handle->new (
33 fh => $fh, on_eof => sub { $c->send ($buf) },
39 "GET\040http://localhost:19090/test\040HTTP/1.0\015\012Content-Length:\015\012 10\015\012Content-Type: text/html;\015\012 charSet = \"ISO-8859-1\"; Foo=1\015\012\015\012ABC1234567"
45 ok ($r =~ /Test response/m, 'test response ok');
46 ok ($req_hdr =~ /Foo/, 'test header ok');