Skip to content

Commit 08d78c8

Browse files
committed
Added support for input stream when not json encoded
1 parent d3b1577 commit 08d78c8

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/Pecee/Http/Input/InputHandler.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public function parseInputs(): void
8282
if ($post !== false) {
8383
$this->originalPost += $post;
8484
}
85+
} else {
86+
parse_str($contents, $this->originalPost);
8587
}
8688
}
8789

@@ -108,7 +110,7 @@ public function parseFiles(array $files, ?string $parentKey = null): array
108110
foreach ($files as $key => $value) {
109111

110112
// Parse multi dept file array
111-
if(isset($value['name']) === false && is_array($value) === true) {
113+
if (isset($value['name']) === false && is_array($value) === true) {
112114
$list[$key] = $this->parseFiles($value, $key);
113115
continue;
114116
}
@@ -161,12 +163,12 @@ protected function rearrangeFile(array $values, array &$index, ?array $original)
161163
try {
162164

163165
$file = InputFile::createFromArray([
164-
'index' => ($key === '' && $originalIndex !== '') ? $originalIndex : $key,
165-
'name' => $original['name'][$key],
166-
'error' => $original['error'][$key],
166+
'index' => ($key === '' && $originalIndex !== '') ? $originalIndex : $key,
167+
'name' => $original['name'][$key],
168+
'error' => $original['error'][$key],
167169
'tmp_name' => $original['tmp_name'][$key],
168-
'type' => $original['type'][$key],
169-
'size' => $original['size'][$key],
170+
'type' => $original['type'][$key],
171+
'size' => $original['size'][$key],
170172
]);
171173

172174
if (isset($output[$key]) === true) {
@@ -231,7 +233,7 @@ public function find(string $index, ...$methods)
231233
{
232234
$element = null;
233235

234-
if(count($methods) > 0) {
236+
if (count($methods) > 0) {
235237
$methods = is_array(...$methods) ? array_values(...$methods) : $methods;
236238
}
237239

@@ -303,9 +305,9 @@ public function value(string $index, $defaultValue = null, ...$methods)
303305
public function exists($index, ...$methods): bool
304306
{
305307
// Check array
306-
if(is_array($index) === true) {
307-
foreach($index as $key) {
308-
if($this->value($key, null, ...$methods) === null) {
308+
if (is_array($index) === true) {
309+
foreach ($index as $key) {
310+
if ($this->value($key, null, ...$methods) === null) {
309311
return false;
310312
}
311313
}

0 commit comments

Comments
 (0)