gotzmann / comet

Modern PHP framework for building blazing fast REST APIs and microservices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parsing body with NULL result if http header content-type is 'application/json; charset=utf-8'

baralgin584 opened this issue · comments

Hello!

If Http header "content-type" is 'application/json; charset=utf-8', then getParsedBody() returns NULL, because in class Request this line:

if ($headers['content-type'] == 'application/json') {
                $this->parsedBody = json_decode($request->rawBody(), true);
} 

maybe replace to:

if (strstr($headers['content-type'], 'application/json')) {
                $this->parsedBody = json_decode($request->rawBody(), true);
}

Very great suggestion! Comparison fixed with strstr() in v2.0.2