X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Flive_engine_request_auth.t;fp=t%2Faggregate%2Flive_engine_request_auth.t;h=f5370cebc9f962f6c76be136abbc0c9e9abb9315;hb=4a41d5d1ec3187cc41e15767b21c14b2aee31740;hp=0000000000000000000000000000000000000000;hpb=2757db2c7c600c8a0b8e2b4366f38c97804c2844;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/live_engine_request_auth.t b/t/aggregate/live_engine_request_auth.t new file mode 100644 index 0000000..f5370ce --- /dev/null +++ b/t/aggregate/live_engine_request_auth.t @@ -0,0 +1,43 @@ +#!perl + +# This tests to make sure the Authorization header is passed through by the engine. + +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/../lib"; + +use Test::More tests => 7; +use Catalyst::Test 'TestApp'; + +use Catalyst::Request; +use HTTP::Headers; +use HTTP::Request::Common; + +{ + my $creq; + + my $request = GET( + 'http://localhost/dump/request', + 'Authorization' => 'Basic dGVzdDoxMjM0NQ==', + ); + + ok( my $response = request($request), 'Request' ); + ok( $response->is_success, 'Response Successful 2xx' ); + is( $response->content_type, 'text/plain', 'Response Content-Type' ); + like( $response->content, qr/'Catalyst::Request'/, + 'Content is a serialized Catalyst::Request' ); + + { + no strict 'refs'; + ok( + eval '$creq = ' . $response->content, + 'Unserialize Catalyst::Request' + ); + } + + isa_ok( $creq, 'Catalyst::Request' ); + + is( $creq->header('Authorization'), 'Basic dGVzdDoxMjM0NQ==', 'auth header ok' ); +}