改名
This commit is contained in:
@@ -109,7 +109,10 @@ class HttpHeaders
|
|||||||
*/
|
*/
|
||||||
public function getHeader($name)
|
public function getHeader($name)
|
||||||
{
|
{
|
||||||
return $this->headers[$name] ?? null;
|
if (!isset($this->headers[$name])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $this->headers[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -321,7 +321,11 @@ class Request extends Application
|
|||||||
*/
|
*/
|
||||||
public function getMethod()
|
public function getMethod()
|
||||||
{
|
{
|
||||||
return strtolower($this->headers->getHeader('request_method'));
|
$method = $this->headers->getHeader('request_method');
|
||||||
|
if (empty($method)) {
|
||||||
|
return 'get';
|
||||||
|
}
|
||||||
|
return strtolower($method);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -428,7 +432,7 @@ class Request extends Application
|
|||||||
if (!empty($request->post)) {
|
if (!empty($request->post)) {
|
||||||
$sRequest->params->setPosts($request->post ?? []);
|
$sRequest->params->setPosts($request->post ?? []);
|
||||||
}
|
}
|
||||||
$sRequest->headers = Snowflake::createObject(HttpHeaders::class,[array_merge($request->server, $request->header ?? [])]);
|
$sRequest->headers = Snowflake::createObject(HttpHeaders::class, [array_merge($request->server, $request->header ?? [])]);
|
||||||
return $sRequest;
|
return $sRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,13 +38,14 @@ class JSON
|
|||||||
*/
|
*/
|
||||||
private static function filter($data)
|
private static function filter($data)
|
||||||
{
|
{
|
||||||
array_walk_recursive($data, function (&$value, $key) {
|
array_walk_recursive($data, function ($value, $key) use ($data) {
|
||||||
if (!is_numeric($value)) {
|
if (!is_numeric($value)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is_int(+$value)) {
|
if (is_int(+$value)) {
|
||||||
$value = +$value;
|
$value = +$value;
|
||||||
}
|
}
|
||||||
|
$data[$key] = $value;
|
||||||
});
|
});
|
||||||
return json_encode($data, JSON_UNESCAPED_UNICODE);
|
return json_encode($data, JSON_UNESCAPED_UNICODE);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user