mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
API: be less sensitive about Content-Type, to prevent empty payloads when variations like "application/json; charset=utf-8" are used.
This commit is contained in:
parent
00e6895821
commit
5a5cc7897d
@ -46,9 +46,9 @@ class ApiControllerBase extends ControllerRoot
|
||||
*/
|
||||
private function parseJsonBodyData()
|
||||
{
|
||||
switch ($this->request->getHeader('CONTENT_TYPE')) {
|
||||
switch (strtolower(str_replace(' ', '', $this->request->getHeader('CONTENT_TYPE')))) {
|
||||
case 'application/json':
|
||||
case 'application/json;charset=UTF-8':
|
||||
case 'application/json;charset=utf-8':
|
||||
$jsonRawBody = $this->request->getJsonRawBody(true);
|
||||
if (empty($this->request->getRawBody()) && empty($jsonRawBody)) {
|
||||
return "Invalid JSON syntax";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user