Skip to content

Commit

Permalink
response - added getter json array
Browse files Browse the repository at this point in the history
response - successful only 200 - 299
  • Loading branch information
janatjak committed Oct 6, 2017
1 parent 965385e commit 0367efc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Http/Response.php
Expand Up @@ -3,6 +3,8 @@

namespace FreezyBee\SmokeTester\Http;

use Nette\Utils\Json;

/**
* @author Jakub Janata <jakubjanata@gmail.com>
*/
Expand Down Expand Up @@ -41,6 +43,14 @@ public function getContent(): string
return $this->content;
}

/**
* @return array
*/
public function getContentJsonArray(): array
{
return Json::decode($this->content, Json::FORCE_ARRAY);
}

/**
* @param string $content
*/
Expand All @@ -55,7 +65,7 @@ public function setContent(string $content): void
public function isSuccessful(): bool
{
$code = $this->getCode();
return $code >= 200 && $code < 400;
return $code >= 200 && $code < 300;
}

/**
Expand Down

0 comments on commit 0367efc

Please sign in to comment.