Parsing body with NULL result if http header content-type is 'application/json; charset=utf-8'
baralgin584 opened this issue · comments
baralgin584 commented
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);
}
Serge Gotsuliak commented
Very great suggestion! Comparison fixed with strstr() in v2.0.2