Skip to content

Commit

Permalink
Ensure that withMethod() does what is expected
Browse files Browse the repository at this point in the history
If I call withMethod(), then I expect that what I've set to be what is
set! i.e. we should not check for the magic _METHOD or the
X-Http-Method-Override header if withMethod() has been called.
  • Loading branch information
akrabat committed Dec 6, 2015
1 parent b247f36 commit 45e7f5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Slim/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public function withMethod($method)
$method = $this->filterMethod($method);
$clone = clone $this;
$clone->originalMethod = $method;
$clone->method = null; // <-- Force method override recalculation
$clone->method = $method;

return $clone;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Http/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function testWithMethod()
{
$request = $this->requestFactory()->withMethod('PUT');

$this->assertAttributeEquals(null, 'method', $request);
$this->assertAttributeEquals('PUT', 'method', $request);
$this->assertAttributeEquals('PUT', 'originalMethod', $request);
}

Expand Down

0 comments on commit 45e7f5b

Please sign in to comment.