Skip to content

Commit

Permalink
re-instate data check in setData
Browse files Browse the repository at this point in the history
  • Loading branch information
anlutro committed Oct 30, 2018
1 parent dda7c8e commit b7f47bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public function allowsData()
*/
public function setData($data)
{
if (!$this->allowsData()) {
if ($data !== null && !$this->allowsData()) {
throw new \InvalidArgumentException("HTTP method [$this->method] does not allow POST data.");
}

Expand Down
5 changes: 1 addition & 4 deletions src/cURL.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,9 @@ public function newRequest($method, $url, $data = null, $encoding = Request::ENC
}
$request->setMethod($method);
$request->setUrl($url);
$request->setData($data);
$request->setEncoding($encoding);

if ($data !== null) {
$request->setData($data);
}

return $request;
}

Expand Down

0 comments on commit b7f47bc

Please sign in to comment.