Maurits van der Schee 5 anni fa
parent
commit
7c5cac6da9
2 ha cambiato i file con 16 aggiunte e 2 eliminazioni
  1. 8
    1
      api.php
  2. 8
    1
      src/Tqdev/PhpCrudApi/RequestFactory.php

+ 8
- 1
api.php Vedi 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 Vedi 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…
Annulla
Salva