Skip to content
This repository has been archived by the owner on Feb 13, 2022. It is now read-only.

Commit

Permalink
fix(#181): graphql json content-type header with utf-8 charset
Browse files Browse the repository at this point in the history
  • Loading branch information
leocavalcante committed Aug 9, 2019
1 parent d04d5b9 commit 5209635
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.idea/
*.cache
/*.phar
/.idea/
/coverage-*
/issues/
/vendor/
7 changes: 4 additions & 3 deletions src/GraphQL/GraphQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
*/
function init(Schema $schema, $rootValue = null, $context = null, string $input = 'php://input')
{
if (Request\header('Content-Type') == 'application/json') {
if (preg_match('#application/json(;charset=utf-8)?#', Request\header('Content-Type'))) {
$data = Request\json($input);
} else {
$data = Request\post();
Expand Down Expand Up @@ -140,7 +140,7 @@ function psr7(Schema $schema): Closure
* Also sets a Siler's default field resolver based on $resolvers array.
*
* @param string $typeDefs
* @param array $resolvers
* @param array $resolvers
*
* @return Schema
*/
Expand Down Expand Up @@ -218,7 +218,8 @@ function subscriptions(
int $port = 5000,
array $rootValue = [],
array $context = []
): IoServer {
): IoServer
{
$manager = new SubscriptionsManager($schema, $filters, $rootValue, $context);
$server = new SubscriptionsServer($manager);
$websocket = new WsServer($server);
Expand Down

0 comments on commit 5209635

Please sign in to comment.