Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Recognise PATCH as a valid HTTP verb. #1

Closed
wants to merge 2 commits into from

2 participants

David Precious Jesse Vincent
David Precious

This is defined in RFC5789: http://tools.ietf.org/html/rfc5789

This is in active use by GitHub's v3 API, among others.

As a quick overview for anyone unfamilar with PATCH, it's basically a
partial-PUT, passing only the changes - for instance, let's say you wanted to
update a customer's contact email address, you might send a PATCH request to
/customer/42/contactdetails with a JSON payload describing just the parts
which have changed, for instance { email: 'bob@example.com' }.

added some commits October 17, 2011
David Precious Recognise PATCH as a valid HTTP verb.
This is defined in RFC5789: http://tools.ietf.org/html/rfc5789

This is in active use by GitHub's v3 API, among others.

As a quick overview for anyone unfamilar with PATCH, it's basically a
partial-PUT, passing only the changes - for instance, let's say you wanted to
update a customer's contact email address, you might send a PATCH request to
`/customer/42/contactdetails` with a JSON payload describing just the parts
which have changed, for instance `{ email: 'bob@example.com' }`.
f7382f2
David Precious Gah - unbreak it!
(Sorry - just have used $ to jump to EOL in insert mode by mistake or something,
and didn't notice.  Despite it being  a simple change, I should have tested it
before submitting the PR.  /me hangs head)
d68c956
Jesse Vincent

Would you mind rebasing, so we just have one clean commit to merge?

David Precious

Sure - closing this PR, and replacing it with one with a single commit.

David Precious bigpresh closed this November 28, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Oct 17, 2011
David Precious Recognise PATCH as a valid HTTP verb.
This is defined in RFC5789: http://tools.ietf.org/html/rfc5789

This is in active use by GitHub's v3 API, among others.

As a quick overview for anyone unfamilar with PATCH, it's basically a
partial-PUT, passing only the changes - for instance, let's say you wanted to
update a customer's contact email address, you might send a PATCH request to
`/customer/42/contactdetails` with a JSON payload describing just the parts
which have changed, for instance `{ email: 'bob@example.com' }`.
f7382f2
David Precious Gah - unbreak it!
(Sorry - just have used $ to jump to EOL in insert mode by mistake or something,
and didn't notice.  Despite it being  a simple change, I should have tested it
before submitting the PR.  /me hangs head)
d68c956
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. 6  lib/HTTP/Server/Simple.pm
6  lib/HTTP/Server/Simple.pm
@@ -701,15 +701,15 @@ sub bad_request {
701 701
 
702 702
 Given a candidate HTTP method in $method, determine if it is valid.
703 703
 Override if, for example, you'd like to do some WebDAV.  The default
704  
-implementation only accepts C<GET>, C<POST>, C<HEAD>, C<PUT>, and
705  
-C<DELETE>.
  704
+implementation only accepts C<GET>, C<POST>, C<HEAD>, C<PUT>, C<PATCH>
  705
+and C<DELETE>.
706 706
 
707 707
 =cut 
708 708
 
709 709
 sub valid_http_method {
710 710
     my $self   = shift;
711 711
     my $method = shift or return 0;
712  
-    return $method =~ /^(?:GET|POST|HEAD|PUT|DELETE)$/;
  712
+    return $method =~ /^(?:GET|POST|HEAD|PUT|PATCH|DELETE)$/;
713 713
 }
714 714
 
715 715
 =head1 AUTHOR
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.