phpunit URL Requests backend test file
This commit is contained in:
28
4dev/tests/AAASetupData/requests/http_requests.php
Normal file
28
4dev/tests/AAASetupData/requests/http_requests.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AUTHOR: Clemens Schwaighofer
|
||||||
|
* CREATED: Ymd
|
||||||
|
* DESCRIPTION:
|
||||||
|
* DescriptionHere
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$http_headers = array_filter($_SERVER, function ($value, $key) {
|
||||||
|
if (str_starts_with($key, 'HTTP_')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}, ARRAY_FILTER_USE_BOTH);
|
||||||
|
|
||||||
|
$file_get = file_get_contents('php://input') ?: '["code": 500, "content": {"Error" => "file_get_contents failed"}]';
|
||||||
|
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
|
||||||
|
print json_encode([
|
||||||
|
'HEADERS' => $http_headers,
|
||||||
|
"PARAMS" => $_GET,
|
||||||
|
"BODY" => json_decode($file_get, true),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// __END__
|
||||||
Reference in New Issue
Block a user