Skip to content

Commit

Permalink
fix request method to use $_GET variables when HEAD (#24092)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lynn Lin authored and taylorotwell committed May 3, 2018
1 parent ba7a8d8 commit c766cbb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ protected function getInputSource()
return $this->json();
}

return $this->getRealMethod() == 'GET' ? $this->query : $this->request;
return in_array($this->getRealMethod(), ['GET', 'HEAD']) ? $this->query : $this->request;
}

/**
Expand Down
7 changes: 7 additions & 0 deletions tests/Http/HttpRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,13 @@ public function testReplaceMethod()
$this->assertEquals('Dayle', $request->input('buddy'));
}

public function testOffsetUnsetMethod()
{
$request = Request::create('/', 'HEAD', ['name' => 'Taylor']);
$request->offsetUnset('name');
$this->assertNull($request->input('name'));
}

public function testHeaderMethod()
{
$request = Request::create('/', 'GET', [], [], [], ['HTTP_DO_THIS' => 'foo']);
Expand Down

0 comments on commit c766cbb

Please sign in to comment.