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