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
         $psr17Factory = new Psr17Factory();
7242
         $psr17Factory = new Psr17Factory();
7243
         $creator = new ServerRequestCreator($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory);
7243
         $creator = new ServerRequestCreator($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory);
7244
         $serverRequest = $creator->fromGlobals();
7244
         $serverRequest = $creator->fromGlobals();
7245
+        $uri = '';
7245
         if (isset($_SERVER['PATH_INFO'])) {
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
         $body = file_get_contents('php://input');
7255
         $body = file_get_contents('php://input');
7249
         if ($body) {
7256
         if ($body) {

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

34
         $psr17Factory = new Psr17Factory();
34
         $psr17Factory = new Psr17Factory();
35
         $creator = new ServerRequestCreator($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory);
35
         $creator = new ServerRequestCreator($psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory);
36
         $serverRequest = $creator->fromGlobals();
36
         $serverRequest = $creator->fromGlobals();
37
+        $uri = '';
37
         if (isset($_SERVER['PATH_INFO'])) {
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
         $body = file_get_contents('php://input');
47
         $body = file_get_contents('php://input');
41
         if ($body) {
48
         if ($body) {

Loading…
Cancel
Save