CPAN-Mini-Webserver-PSGI

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

use Module::Build;

my $builder = Module::Build->new(
    module_name => 'CPAN::Mini::Webserver::PSGI',
  'build_requires' => {
    'Compress::Zlib' => '2.033',
    'File::Path' => '2.08',
    'File::Slurp' => '9999.16',
    'HTTP::Request::Common' => '6.00',
    'Module::Build' => '0.3601',
    'Plack::Test' => '0',
    'Test::Builder' => '0.98',
    'URI' => '1.58'
  },
  'configure_requires' => {
    'Module::Build' => '0.3601'
  },
  'requires' => {
    'CGI' => '3.53',

META.yml  view on Meta::CPAN

---
abstract: 'Use CPAN::Mini::Webserver as a PSGI application'
author:
  - 'Rob Hoelz <rob@hoelz.ro>'
build_requires:
  Compress::Zlib: 2.033
  File::Path: 2.08
  File::Slurp: 9999.16
  HTTP::Request::Common: 6.00
  Module::Build: 0.3601
  Plack::Test: 0
  Test::Builder: 0.98
  URI: 1.58
configure_requires:
  Module::Build: 0.3601
dynamic_config: 0
generated_by: 'Dist::Zilla version 4.200005, CPAN::Meta::Converter version 2.110930'
license: perl
meta-spec:

t/WebserverTester.pm  view on Meta::CPAN

package WebserverTester;
use base qw(Exporter);

# Copied and adapted from the CPAN-Mini-Webserver-0.51 distribution

use strict;
use warnings;

use HTTP::Request;
use Plack::Test;
use Test::Builder;
use URI;
use URI::QueryParam;

our @EXPORT;
my $app;

{

t/WebserverTester.pm  view on Meta::CPAN

sub make_request {
    my $path = shift;

    my $uri = URI->new($path, 'http');

    while ( @_ ) {
        my $name  = shift;
        my $value = shift;
        $uri->query_param($name, $value);
    }
    my $req = HTTP::Request->new(GET => $uri);

    my $res;
    test_psgi $app, sub {
        my ( $cb ) = @_;

        $res = $cb->($req);
    };

    return wantarray
      ? ( $res->code || "", $res->header( "Content-Type" ) || "", $res->content || "", $res )



( run in 0.510 second using v1.01-cache-2.11-cpan-de7293f3b23 )