Skip to content

Commit

Permalink
allow charset=utf-8 in accept header
Browse files Browse the repository at this point in the history
  • Loading branch information
raffis committed Jan 13, 2020
1 parent 2b347f6 commit 69d5d0d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ public function setupFormats(): self

//through HTTP_ACCEPT
if (isset($_SERVER['HTTP_ACCEPT']) && false === strpos($_SERVER['HTTP_ACCEPT'], '*/*')) {
foreach (self::OUTPUT_FORMATS as $format) {
if (false !== strpos($_SERVER['HTTP_ACCEPT'], $format)) {
foreach (self::OUTPUT_FORMATS as $format => $type) {
if (false !== strpos($_SERVER['HTTP_ACCEPT'], $type)) {
$this->output_format = $format;

break;
Expand Down
2 changes: 1 addition & 1 deletion src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ protected function decodeRequest(array $parsed_params): array

return array_merge($decode, $_REQUEST, $parsed_params);
}
if ('application/json' === $this->content_type) {
if ('application/json' === $this->content_type || 'application/json; charset=utf-8' === $this->content_type) {
$body = file_get_contents('php://input');
$json_params = [];

Expand Down

0 comments on commit 69d5d0d

Please sign in to comment.