summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Marienborg <andreas.marienborg@gmail.com>2012-02-06 16:26:27 +0100
committerAndreas Marienborg <andreas.marienborg@gmail.com>2012-02-06 16:26:27 +0100
commitdbdb9a3b028fe0c98d40a238062e9c3d09f06afe (patch)
tree890bacac168fcd37fc3ae435ac9851daea31efc1
parentMerge branch 'bricas' (diff)
downloadnet-http-spore-dbdb9a3b028fe0c98d40a238062e9c3d09f06afe.tar.gz
Support PATCH method (that github uses)
-rw-r--r--lib/Net/HTTP/Spore/Meta/Method.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Net/HTTP/Spore/Meta/Method.pm b/lib/Net/HTTP/Spore/Meta/Method.pm
index 2e55a89..f3d440f 100644
--- a/lib/Net/HTTP/Spore/Meta/Method.pm
+++ b/lib/Net/HTTP/Spore/Meta/Method.pm
@@ -17,7 +17,7 @@ subtype UriPath
     => where { $_ =~ m!^/! }
     => message {"path must start with /"};
 
-enum Method => qw(OPTIONS HEAD GET POST PUT DELETE TRACE);
+enum Method => qw(OPTIONS HEAD GET POST PUT DELETE TRACE PATCH);
 
 subtype 'JSON::XS::Boolean' => as 'JSON::XS::Boolean';
 subtype 'JSON::PP::Boolean' => as 'JSON::PP::Boolean';
@@ -144,7 +144,7 @@ sub wrap {
           : delete $method_args{payload};
 
         if ( $payload
-            && ( $method->method !~ /^P(?:OS|U)T$/i ) )
+            && ( $method->method !~ /^(?:POST|PUT|PATCH)$/i ) )
         {
             die Net::HTTP::Spore::Response->new( 599, [],
                 { error => "payload requires a PUT or POST method" },