Skip to content

Commit 43bc90c

Browse files
committed
Update request body detection
1 parent dfb4967 commit 43bc90c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/WaterPipe/Routing/Router.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,8 @@ private function _detectUri()
178178
} elseif ($this->_request->getMethod() === RequestMethod::PUT || $this->_request->getMethod() === RequestMethod::PATCH) {
179179
$handle = fopen("php://input", "r");
180180
$rawData = '';
181-
while ($chunk = fread($handle, 1024)) {
182-
$rawData .= $chunk;
183-
}
181+
while ($chunk = fread($handle, 1024)) $rawData .= $chunk;
182+
fclose($handle);
184183

185184
switch ($contentType) {
186185
case "application/json":
@@ -189,7 +188,7 @@ private function _detectUri()
189188
case "application/xml":
190189
$data = (array)simplexml_load_string($rawData);
191190
break;
192-
default:
191+
case "application/x-www-form-urlencoded":
193192
parse_str($rawData, $data);
194193
break;
195194
}
@@ -203,6 +202,9 @@ private function _detectUri()
203202
case "application/xml":
204203
$data = (array)simplexml_load_string($rawData);
205204
break;
205+
case "application/x-www-form-urlencoded":
206+
parse_str($rawData, $data);
207+
break;
206208
}
207209
}
208210

0 commit comments

Comments
 (0)