作者 karlet

feat:修复ser

... ... @@ -11,6 +11,7 @@ class SimpleRequest
public string $method;
public array $header;
public array $cookie;
public string $rawContent;
public function __construct($data)
{
... ... @@ -21,5 +22,14 @@ class SimpleRequest
$this->method = $data['method'];
$this->header = $data['header'];
$this->cookie = $data['cookie'];
$this->rawContent = $data['rawContent'];
if ($this->method == 'POST') {
if (count($this->post) == 0) {
$data = json_decode($this->rawContent, true);
if ($data) {
$this->post = $data;
}
}
}
}
}
... ...
... ... @@ -40,6 +40,7 @@ class SimpleServerCoroutine
'method' => $request->getMethod(),
'header' => $request->header ?: [],
'cookie' => $request->cookie ?: [],
'rawContent' => $request->rawContent() ?: ''
];
$simpleRequest = new SimpleRequest($requestInfo);
$res = call_user_func($callback, $simpleRequest);
... ...