Skip to content

Commit

Permalink
fixed support for delete as well as put methods
Browse files Browse the repository at this point in the history
  • Loading branch information
pablohaedo committed Oct 4, 2019
1 parent c059f65 commit 3da5858
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion DNSMadeEasy/driver/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ class Response
505 => 'HTTP Version Not Supported',
);

/**
* These methods won't receive a response body
* @var array
*/
private $_httpMethodsWithoutBody = array(
'delete',
'put',
);

/**
* Construct the driver response.
* @param string $response The response containing the headers and body as a string.
Expand Down Expand Up @@ -207,7 +216,7 @@ private function parseMessage($message, $method)
$border = strpos($message, $barrier);

if ($border === false) {
if ('put' == $method) {
if (in_array($method,$this->_httpMethodsWithoutBody)) {
$border = strlen($message);
} else {
throw new RESTException('Got an invalid response from the server.');
Expand Down

0 comments on commit 3da5858

Please sign in to comment.