Skip to content

Commit

Permalink
use header_name attribute in Runtime middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Jan 24, 2014
1 parent c5a3896 commit 5394229
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Plack/Middleware/Runtime.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ sub call {

my $start = [ Time::HiRes::gettimeofday ];
my $res = $self->app->($env);
my $header = $self->header_name || 'X-Runtime';

$self->response_cb($res, sub {
my $res = shift;
my $req_time = sprintf '%.6f', Time::HiRes::tv_interval($start);
Plack::Util::header_set($res->[1], 'X-Runtime', $req_time);
Plack::Util::header_set($res->[1], $header, $req_time);
});
}

Expand Down

0 comments on commit 5394229

Please sign in to comment.