new middleware
[catagits/Catalyst-Runtime.git] / lib / Catalyst / ActionRole / HTTPMethods.pm
index a0ab7e2..8d9033d 100644 (file)
@@ -4,7 +4,7 @@ use Moose::Role;
 
 requires 'match', 'match_captures', 'list_extra_info';
 
-around ['match','match_captures'], sub {
+around ['match','match_captures'] => sub {
   my ($orig, $self, $ctx, @args) = @_;
   my $expected = $self->_normalize_expected_http_method($ctx->req);
   return $self->_has_expected_http_method($expected) ?
@@ -17,6 +17,7 @@ sub _normalize_expected_http_method {
   return $req->header('X-HTTP-Method') ||
     $req->header('X-HTTP-Method-Override') ||
     $req->header('X-METHOD-OVERRIDE') ||
+    $req->header('x-tunneled-method') ||
     $req->method;
 }
 
@@ -29,11 +30,11 @@ sub _has_expected_http_method {
 
 sub allowed_http_methods { @{shift->attributes->{Method}||[]} }
 
-around 'list_extra_info', sub {
+around 'list_extra_info' => sub {
   my ($orig, $self, @args) = @_;
   return {
     %{ $self->$orig(@args) }, 
-    +{ HTTP_METHODS => [sort $self->allowed_http_methods] }
+    HTTP_METHODS => [sort $self->allowed_http_methods],
   };
 };
 
@@ -87,6 +88,8 @@ work well with existing systems and common client side tools.
 
 =item X-METHOD-OVERRIDE (IBM)
 
+=item x-tunneled-method (used in many other similar systems on CPAN
+
 =back 
 
 Please note the insanity of overriding a GET request with a DELETE override...