allow headers on CLI calls
Matt S Trout [Sun, 22 Apr 2012 17:28:14 +0000 (17:28 +0000)]
Changes
lib/Web/Simple/Application.pm

diff --git a/Changes b/Changes
index 9341251..3ababd7 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+  - Allow headers on CLI calls
+
+0.013 - 2012-04-03
   - Fix a weird interaction between match-spec parsing and module loading
     that was causing brokenness and test failures with perl 5.8.8
 
index bd57c3b..f6804dc 100644 (file)
@@ -89,6 +89,15 @@ sub _test_request_spec_to_http_request {
 
   my $request = HTTP::Request->new($method => $path);
 
+  my @params;
+
+  while (my ($header, $value) = splice(@rest, 0, 2)) {
+    unless ($header =~ s/:$//) {
+      push @params, $header, $value;
+    }
+    $request->headers->push_header($header, $value);
+  }
+
   if (($method eq 'POST' or $method eq 'PUT') and @rest) {
     my $content = do {
       require URI;