Commit | Line | Data |
4b9bbaf9 |
1 | package CatalystX::Debug::RequestHeaders; |
2ab3d8c4 |
2 | use Moose::Role; |
4b9bbaf9 |
3 | use namespace::autoclean; |
4 | |
fc1c7e79 |
5 | our $VERSION = '0.002'; |
256ec05c |
6 | |
2ab3d8c4 |
7 | requires 'log_request_headers'; |
8 | |
9 | around log_request_headers => sub { |
10 | my $orig = shift; |
11 | my $c = shift; |
12 | my $headers = shift; # an HTTP::Headers instance |
13 | |
14 | return unless $c->debug; |
15 | |
16 | $c->log_headers('request', $headers); |
17 | }; |
18 | |
4b9bbaf9 |
19 | 1; |
20 | |
21 | =head1 NAME |
22 | |
2ab3d8c4 |
23 | CatalystX::Debug::RequestHeaders - Log the full request headers sent to a Catalyst application in debug mode |
24 | |
25 | =head1 SYNOPSIS |
26 | |
27 | use Catalyst qw/ |
28 | +CatalystX::Debug::RequestHeaders |
29 | /; |
4b9bbaf9 |
30 | |
31 | =head1 DESCRIPTION |
32 | |
2ab3d8c4 |
33 | Prints a L<Text::SimpleTable> style table containing all the headers sent from the |
34 | user's browser to the application for each request when the application is in debug mode. |
35 | |
4b9bbaf9 |
36 | =head1 METHODS |
37 | |
2ab3d8c4 |
38 | =head2 log_request_headers |
39 | |
40 | This hook method in L<Catalyst> is wrapped to call the L<Catalyst/log_headers> method |
41 | for the request headers. |
42 | |
4b9bbaf9 |
43 | =head1 BUGS |
44 | |
2ab3d8c4 |
45 | None known, but there probably are some. |
46 | |
47 | Patches are welcome, as are bug reports in the L<rt.cpan.org> bug tracker. |
48 | |
4b9bbaf9 |
49 | =head1 AUTHOR |
50 | |
2ab3d8c4 |
51 | Tomas Doran (t0m) C<< <bobtfish@bobtfish.net> >>. |
52 | |
4b9bbaf9 |
53 | =head1 COPYRIGHT & LICENSE |
54 | |
2ab3d8c4 |
55 | Copyright 2010 the above author(s). |
4b9bbaf9 |
56 | |
57 | This sofware is free software, and is licensed under the same terms as perl itself. |
58 | |
59 | =cut |
60 | |