Parses a HTTP request body.
public function parse($rawBody, $contentType)
{
// converts JSONP to JSON
if (strpos($contentType, 'application/javascript') !== false) {
$rawBody = preg_filter('/(^[^{]+|[^}]+$)/', '', $rawBody);
}
try {
$parameters = Json::decode($rawBody, $this->asArray);
return $parameters === null ? [] : $parameters;
} catch (InvalidArgumentException $e) {
if ($this->throwException) {
throw new BadRequestHttpException('Invalid JSON data in request body: ' . $e->getMessage());
}
return [];
}
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4