Skip to content

Commit 5ccc8fb

Browse files
committed
Merge branch 'master' of https://github.com/KnifeLemon/core
2 parents dc56ca2 + 82daf71 commit 5ccc8fb

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

flight/net/Request.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,7 @@ protected function parseRequestBodyForHttpMethods(): void
639639
$data[$keyName] = [$data[$keyName]];
640640
}
641641
$data[$keyName][] = $value;
642-
}
643-
else {
642+
} else {
644643
$data[$keyName] = $value;
645644
}
646645
continue;
@@ -667,8 +666,7 @@ protected function parseRequestBodyForHttpMethods(): void
667666

668667
if ($bytes === false) {
669668
$tmpFile['error'] = UPLOAD_ERR_CANT_WRITE;
670-
}
671-
else {
669+
} else {
672670
// delete the temporary file before ended script
673671
register_shutdown_function(function () use ($tmpName): void {
674672
if (file_exists($tmpName)) {

tests/RequestBodyParserTest.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,32 +63,8 @@ private function createRequestConfig(string $method, string $contentType, string
6363
private function assertUrlEncodedParsing(string $method): void
6464
{
6565
$body = 'foo=bar&baz=qux&key=value';
66-
$tmpfile = tmpfile();
67-
$stream_path = stream_get_meta_data($tmpfile)['uri'];
68-
file_put_contents($stream_path, $body);
69-
70-
$config = [
71-
'url' => '/',
72-
'base' => '/',
73-
'method' => $method,
74-
'referrer' => '',
75-
'ip' => '127.0.0.1',
76-
'ajax' => false,
77-
'scheme' => 'http',
78-
'user_agent' => 'Test',
79-
'type' => 'application/x-www-form-urlencoded',
80-
'length' => strlen($body),
81-
'secure' => false,
82-
'accept' => '',
83-
'proxy_ip' => '',
84-
'host' => 'localhost',
85-
'servername' => 'localhost',
86-
'stream_path' => $stream_path,
87-
'data' => new Collection(),
88-
'query' => new Collection(),
89-
'cookies' => new Collection(),
90-
'files' => new Collection()
91-
];
66+
$tmpfile = null;
67+
$config = $this->createRequestConfig($method, 'application/x-www-form-urlencoded', $body, $tmpfile);
9268

9369
$request = new Request($config);
9470

0 commit comments

Comments
 (0)