Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Recognise PATCH as a valid HTTP verb. #1

Closed
wants to merge 2 commits into from

2 participants

@bigpresh

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' }.

bigpresh added some commits
@bigpresh bigpresh 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
@bigpresh bigpresh 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
@obra
Owner

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

@bigpresh

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

@bigpresh bigpresh closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 17, 2011
  1. @bigpresh

    Recognise PATCH as a valid HTTP verb.

    bigpresh authored
    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' }`.
  2. @bigpresh

    Gah - unbreak it!

    bigpresh authored
    (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)
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/HTTP/Server/Simple.pm
View
6 lib/HTTP/Server/Simple.pm
@@ -701,15 +701,15 @@ sub bad_request {
Given a candidate HTTP method in $method, determine if it is valid.
Override if, for example, you'd like to do some WebDAV. The default
-implementation only accepts C<GET>, C<POST>, C<HEAD>, C<PUT>, and
-C<DELETE>.
+implementation only accepts C<GET>, C<POST>, C<HEAD>, C<PUT>, C<PATCH>
+and C<DELETE>.
=cut
sub valid_http_method {
my $self = shift;
my $method = shift or return 0;
- return $method =~ /^(?:GET|POST|HEAD|PUT|DELETE)$/;
+ return $method =~ /^(?:GET|POST|HEAD|PUT|PATCH|DELETE)$/;
}
=head1 AUTHOR
Something went wrong with that request. Please try again.