/t/020_interface/lighty-fcgi.t

http://github.com/http-engine/HTTP-Engine · Raku · 43 lines · 41 code · 1 blank · 1 comment · 0 complexity · fa02328c461c46246d2c5a520c6b3fb0 MD5 · raw file

  1. use strict;
  2. use warnings;
  3. use Test::More;
  4. use LWP::UserAgent;
  5. use t::FCGIUtils;
  6. # DO TESTS.
  7. test_lighty(
  8. <<'...',
  9. #!/usr/bin/perl
  10. use strict;
  11. use warnings;
  12. use HTTP::Engine;
  13. use HTTP::Engine::Response;
  14. HTTP::Engine->new(
  15. interface => {
  16. module => 'FCGI',
  17. args => {
  18. nproc => 1,
  19. },
  20. request_handler => sub {
  21. my $req = shift;
  22. HTTP::Engine::Response->new(
  23. body => "OK",
  24. );
  25. }
  26. },
  27. )->run;
  28. ...
  29. sub {
  30. my ($port, ) = @_;
  31. plan tests => 2;
  32. my $ua = LWP::UserAgent->new();
  33. my $res = $ua->get("http://localhost:$port/");
  34. ok $res->is_success;
  35. is $res->content, "OK";
  36. },
  37. );