$headerValue) { if ('content-type' !== strtolower($headerName)) { continue; } $contentType = strtolower(trim(explode(';', $headerValue, 2)[0])); switch ($contentType) { case 'application/x-www-form-urlencoded': case 'multipart/form-data': $post = $_POST; break 2; case 'application/json': case 'application/vnd.api+json': try { $json = file_get_contents('php://input'); $post = json_decode($json, true, 512, JSON_THROW_ON_ERROR); if (!is_array($post)) { $post = null; } } catch (JsonException $e) { $post = null; } break 2; } } } // Remove _url from ngnix routes. $get = $_GET; unset($get['_url']); if (isset($server['QUERY_STRING'])) { $query = $server['QUERY_STRING']; if (strpos($query, '_url=') !== false) { parse_str($query, $query); unset($query['_url']); $server['QUERY_STRING'] = http_build_query($query); } } return $creator->fromArrays($server, $headers, $_COOKIE, $get, $post, $_FILES, fopen('php://input', 'rb') ?: null); }; $container['route'] = $container->factory(function () { return clone Uri::getCurrentRoute(); }); } }