Skip to content

Commit bf0b5a6

Browse files
committed
bug fixed for create request
1 parent 6cf2124 commit bf0b5a6

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/HttpFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ public static function createServerRequest($method, $uri)
9797
/**
9898
* Create a new server request from server variables.
9999
* @param array|mixed $server Typically $_SERVER or similar structure.
100-
* @param string|null $class The class
100+
* @param string|null $class The custom request class
101101
* @return ServerRequestInterface
102102
* @throws \RuntimeException
103103
* @throws \InvalidArgumentException
104104
* If no valid method or URI can be determined.
105105
*/
106-
public static function createServerRequestFromArray($server, $class = null)
106+
public static function createServerRequestFromArray($server, string $class = null)
107107
{
108108
$env = self::ensureIsCollection($server);
109109
$uri = static::createUriFromArray($env);
110-
$method = $env['REQUEST_METHOD'];
110+
$method = $env->get('REQUEST_METHOD', 'GET');
111111
$headers = static::createHeadersFromArray($env);
112112
$cookies = Cookies::parseFromRawHeader($headers->get('Cookie', []));
113113
$serverParams = $env->all();

src/Traits/RequestTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public function getRequestTarget(): string
249249
* @param string $requestTarget
250250
* @return $this
251251
*/
252-
public function withRequestTarget(string $requestTarget)
252+
public function withRequestTarget($requestTarget)
253253
{
254254
if (preg_match('#\s#', $requestTarget)) {
255255
throw new \InvalidArgumentException(

0 commit comments

Comments
 (0)