Commit dbd4146a authored by Mahmoud Aglan's avatar Mahmoud Aglan

test

parent 3dc95862
......@@ -25,6 +25,17 @@ final class Request
$this->cookies = $_COOKIE;
$this->body = file_get_contents('php://input') ?: '';
// Merge JSON body into post array so ->post() works for JSON requests
if (empty($this->post) && $this->body !== '') {
$contentType = $this->server['CONTENT_TYPE'] ?? $this->server['HTTP_CONTENT_TYPE'] ?? '';
if (str_contains($contentType, 'json')) {
$decoded = json_decode($this->body, true);
if (is_array($decoded)) {
$this->post = $decoded;
}
}
}
$this->method = strtoupper($this->server['REQUEST_METHOD'] ?? 'GET');
if ($this->method === 'POST') {
$override = $this->post['_method'] ?? null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment