Skip to content

Commit

Permalink
Fix PATCH not automatically decoding known request bodies.
Browse files Browse the repository at this point in the history
Requests using PATCH should also have their bodies automatically
converted into $this->request->data.

Refs #5215
  • Loading branch information
markstory committed Nov 22, 2014
1 parent ca27995 commit 539f0f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Controller/Component/RequestHandlerComponent.php
Expand Up @@ -417,6 +417,7 @@ public function requestedWith($type = null) {
$request = $this->request;
if (!$request->is('post') &&
!$request->is('put') &&
!$request->is('patch') &&
!$request->is('delete')
) {
return null;
Expand Down
Expand Up @@ -616,6 +616,9 @@ public function testRequestContentTypes() {
$result = $this->RequestHandler->requestedWith(array('rss', 'atom'));
$this->assertFalse($result);

$this->request->env('REQUEST_METHOD', 'PATCH');
$this->assertEquals('json', $this->RequestHandler->requestedWith());

$this->request->env('REQUEST_METHOD', 'DELETE');
$this->assertEquals('json', $this->RequestHandler->requestedWith());

Expand Down

0 comments on commit 539f0f6

Please sign in to comment.