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