public theResponseIsJson ( string $notJson = '' ) : void | ||
$notJson | string | |
return | void |
public function theResponseIsJson($notJson = '')
{
$this->processResponse();
if (strpos($notJson, 'not') === false) {
if (!$this->responseIsJson) {
$message = "Response was not JSON\n";
if (!empty($this->responseDecodeException)) {
$message .= $this->responseDecodeException->getMessage();
}
throw new \Exception($message . "\n" . $this->response);
}
} else {
if ($this->responseIsJson) {
throw new \Exception("Response was JSON\n" . $this->response);
}
}
}