Maurits van der Schee 5 years ago
parent
commit
7c5cac6da9
2 changed files with 16 additions and 2 deletions
  1. 8
    1
      api.php
  2. 8
    1
      src/Tqdev/PhpCrudApi/RequestFactory.php

+ 8
- 1
api.php View File

@@ -7242,8 +7242,15 @@ class RequestFactory
7242 7242
         $psr17Factory = new Psr17Factory();
7243 7243
         $creator = new ServerRequestCreator($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory);
7244 7244
         $serverRequest = $creator->fromGlobals();
7245
+        $uri = '';
7245 7246
         if (isset($_SERVER['PATH_INFO'])) {
7246
-            $serverRequest = $serverRequest->withUri($psr17Factory->createUri($_SERVER['PATH_INFO'] . '?' . $_SERVER['QUERY_STRING']));
7247
+            $uri .= $_SERVER['PATH_INFO'];
7248
+        }
7249
+        if (isset($_SERVER['QUERY_STRING'])) {
7250
+            $uri .= '?' . $_SERVER['QUERY_STRING'];
7251
+        }
7252
+        if ($uri) {
7253
+            $serverRequest = $serverRequest->withUri($psr17Factory->createUri($uri));
7247 7254
         }
7248 7255
         $body = file_get_contents('php://input');
7249 7256
         if ($body) {

+ 8
- 1
src/Tqdev/PhpCrudApi/RequestFactory.php View File

@@ -34,8 +34,15 @@ class RequestFactory
34 34
         $psr17Factory = new Psr17Factory();
35 35
         $creator = new ServerRequestCreator($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory);
36 36
         $serverRequest = $creator->fromGlobals();
37
+        $uri = '';
37 38
         if (isset($_SERVER['PATH_INFO'])) {
38
-            $serverRequest = $serverRequest->withUri($psr17Factory->createUri($_SERVER['PATH_INFO'] . '?' . $_SERVER['QUERY_STRING']));
39
+            $uri .= $_SERVER['PATH_INFO'];
40
+        }
41
+        if (isset($_SERVER['QUERY_STRING'])) {
42
+            $uri .= '?' . $_SERVER['QUERY_STRING'];
43
+        }
44
+        if ($uri) {
45
+            $serverRequest = $serverRequest->withUri($psr17Factory->createUri($uri));
39 46
         }
40 47
         $body = file_get_contents('php://input');
41 48
         if ($body) {

Loading…
Cancel
Save