protected function prepareBody($body, $contentType)
{
if (is_string($body) && Str::startsWith($body, ['json', 'file'])) {
list($type, $path) = explode(':', $body);
if (!Str::endsWith($path, '.json') && $type == 'json') {
$path .= '.json';
}
$body = $this->files->get($this->includePath . '/' . $path);
json_decode($body);
if (json_last_error() == JSON_ERROR_NONE) {
return $body;
}
}
if (strpos($contentType, 'application/json') === 0) {
return json_encode($body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
}
return $body;
}