summaryrefslogtreecommitdiff
path: root/lib/Net/HTTP/Spore
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Net/HTTP/Spore')
-rw-r--r--lib/Net/HTTP/Spore/Middleware/Runtime.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Net/HTTP/Spore/Middleware/Runtime.pm b/lib/Net/HTTP/Spore/Middleware/Runtime.pm
index 1614c31..1efcb53 100644
--- a/lib/Net/HTTP/Spore/Middleware/Runtime.pm
+++ b/lib/Net/HTTP/Spore/Middleware/Runtime.pm
@@ -1,5 +1,7 @@
package Net::HTTP::Spore::Middleware::Runtime;
+# ABSTRACT: add a new header with runtime
+
use Moose;
extends 'Net::HTTP::Spore::Middleware';
use Time::HiRes;
@@ -20,3 +22,15 @@ sub call {
}
1;
+
+=head1 SYNOPSIS
+
+ my $client = Net::HTTP::Spore->new_from_spec('twitter.json');
+ $client->enable('Runtime');
+
+ my $result = $client->public_timeline;
+ say "request executed in ".$result->header('X-Spore-Runtime');
+
+=head1 DESCRIPTION
+
+Net::HTTP::Spore::Middleware::Runtime is a middleware that add a new header to the response's headers: X-Spore-Runtime. The value of the header is the time the request took to be executed.