Create branch register_actions.
[catagits/Catalyst-Runtime.git] / t / aggregate / live_engine_request_auth.t
CommitLineData
25f55123 1#!perl
2
3# This tests to make sure the Authorization header is passed through by the engine.
4
5use strict;
6use warnings;
7
8use FindBin;
ae29b412 9use lib "$FindBin::Bin/../lib";
25f55123 10
11use Test::More tests => 7;
12use Catalyst::Test 'TestApp';
13
14use Catalyst::Request;
15use HTTP::Headers;
16use HTTP::Request::Common;
17
18{
19 my $creq;
20
21 my $request = GET(
22 'http://localhost/dump/request',
23 'Authorization' => 'Basic dGVzdDoxMjM0NQ==',
24 );
25
26 ok( my $response = request($request), 'Request' );
27 ok( $response->is_success, 'Response Successful 2xx' );
28 is( $response->content_type, 'text/plain', 'Response Content-Type' );
29 like( $response->content, qr/'Catalyst::Request'/,
30 'Content is a serialized Catalyst::Request' );
31
32 {
33 no strict 'refs';
34 ok(
35 eval '$creq = ' . $response->content,
36 'Unserialize Catalyst::Request'
37 );
38 }
39
40 isa_ok( $creq, 'Catalyst::Request' );
41
42 is( $creq->header('Authorization'), 'Basic dGVzdDoxMjM0NQ==', 'auth header ok' );
43}