HTTP-Engine-Middleware

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.11_01 2009-04-07T13:41:05+09:00
        - refactoring some code to HTTP/Engine/Middleware.pm
        - remove (inner|outer)_middleware support. this feature is perfectly broken.
        - support multiple instance, exactly

	- added Middleware::Status
          and Middleware::Status::Memory
        - Middleware::Static mime_type is manually stringify

0.10    2009-02-27T11:46:35+09:00
        - Encode: fixed some problem on charset of content-type
        - HTTPSession: fixed create instance duped

0.09    2009-02-24T15:08:00+09:00
        - fixed moose's test doesnt work bug (required MooseX::Types)
        - fixed HTTPSession's test doesnt work bug (required HTML::StickyQuery)
        - forget use HTTP::Session in Middleware::HTTPSession

0.08    2009-02-20T14:27:42+09:00
         - release to Any::Moose HTTP::Engine::Middleware

lib/HTTP/Engine/Middleware/Encode.pm  view on Meta::CPAN

has 'content_type_charset' => (
    is      => 'ro',
    isa     => 'Str',
);

before_handle {
    my ( $c, $self, $req ) = @_;

    my $encoding = $self->decode;
    if ($self->detected_decode_by_header) {
        if (( $req->headers->header('content-type') || '' ) =~ /charset\s*=\s*([^\s]+);?$/ ) {
            $encoding = $1;
        }
    }

    # decode parameters
    for my $method (qw/params query_params body_params/) {
        $req->$method( Data::Visitor::Encode->decode( $encoding, $req->$method ) );
    }
    $req;
};

t/200_middlewares/accesslog.t  view on Meta::CPAN

            ::like $message, qr{127.0.0.1 - - \[\d\d/\w+/\d\d:\d\d:\d\d:\d\d \+0000\] "GET /foo\?getparam=1 HTTP/1.0" 200 - "http://example.com/" "internatoexplolerr"};
        }
    }
);

my $request
    = HTTP::Request->new( 'GET' => 'http://localhost/foo?getparam=1', HTTP::Headers->new(
        'User-Agent' => 'internatoexplolerr',
        Referer => 'http://example.com/',
        'Content-Length' => 0,
        'content-type' => 'text/plain',
    ));
my $res = HTTP::Engine->new(
    interface => {
        module          => 'Test',
        request_handler => $mw->handler(
            sub { HTTP::Engine::Response->new( body => 'ok' ) }
        ),
    },
)->run($request);
my $out = $res->content;



( run in 1.584 second using v1.01-cache-2.11-cpan-524268b4103 )