mirror of
https://github.com/Qbix/webserver.git
synced 2026-07-22 07:57:23 +02:00
Added tests
This commit is contained in:
@@ -0,0 +1 @@
|
||||
secret
|
||||
@@ -0,0 +1 @@
|
||||
secret
|
||||
@@ -0,0 +1 @@
|
||||
{"a":1}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
echo "about to exit";
|
||||
exit(1);
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
// Trigger a fatal error
|
||||
call_undefined_function_that_does_not_exist();
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
Q::header('X-Custom-Header: hello');
|
||||
Q::header('Cache-Control: public, max-age=300');
|
||||
Q::header('HTTP/1.1 201 Created', true, 201);
|
||||
echo 'created';
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
Q::header('Content-Type: application/json');
|
||||
echo json_encode([
|
||||
'method' => $_SERVER['REQUEST_METHOD'],
|
||||
'uri' => $_SERVER['REQUEST_URI'],
|
||||
'query' => $_GET,
|
||||
'post' => $_POST,
|
||||
'cookies' => $_COOKIE,
|
||||
'files' => array_map(function($f) { return ['name'=>$f['name'],'size'=>$f['size']]; }, $_FILES),
|
||||
'php_self' => $_SERVER['PHP_SELF'],
|
||||
'doc_root' => $_SERVER['DOCUMENT_ROOT'],
|
||||
'server_sw' => $_SERVER['SERVER_SOFTWARE'],
|
||||
'gateway' => $_SERVER['GATEWAY_INTERFACE'],
|
||||
'remote' => $_SERVER['REMOTE_ADDR'],
|
||||
'scheme' => $_SERVER['REQUEST_SCHEME'],
|
||||
'auth_user' => $_SERVER['PHP_AUTH_USER'] ?? null,
|
||||
'q_class' => class_exists('Q'),
|
||||
'q_request' => class_exists('Q_Request'),
|
||||
'q_config' => class_exists('Q_Config'),
|
||||
'raw_input' => Q_Request::input(),
|
||||
]);
|
||||
@@ -0,0 +1 @@
|
||||
<!DOCTYPE html><html><body><h1>Test Page</h1></body></html>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
sleep(2);
|
||||
echo json_encode(['slept' => 2]);
|
||||
@@ -0,0 +1 @@
|
||||
body{}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
Q::header('Content-Type: application/json');
|
||||
$result = ['post' => $_POST, 'files' => []];
|
||||
foreach ($_FILES as $k => $f) {
|
||||
$result['files'][$k] = [
|
||||
'name' => $f['name'], 'size' => $f['size'],
|
||||
'type' => $f['type'], 'error' => $f['error'],
|
||||
'content' => file_get_contents($f['tmp_name']),
|
||||
];
|
||||
}
|
||||
echo json_encode($result);
|
||||
Reference in New Issue
Block a user