modify
This commit is contained in:
@@ -9,7 +9,6 @@ use HttpServer\Abstracts\HttpService;
|
|||||||
use HttpServer\IInterface\AuthIdentity;
|
use HttpServer\IInterface\AuthIdentity;
|
||||||
use JetBrains\PhpStorm\Pure;
|
use JetBrains\PhpStorm\Pure;
|
||||||
use Server\ServerManager;
|
use Server\ServerManager;
|
||||||
use Snowflake\Abstracts\BaseObject;
|
|
||||||
use Snowflake\Core\Json;
|
use Snowflake\Core\Json;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ class Response extends HttpService
|
|||||||
*/
|
*/
|
||||||
public function setFormat($format): static
|
public function setFormat($format): static
|
||||||
{
|
{
|
||||||
|
if (empty($format)){
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
$this->format = $format;
|
$this->format = $format;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -141,7 +144,6 @@ class Response extends HttpService
|
|||||||
*/
|
*/
|
||||||
public function getResponseFormat(): string
|
public function getResponseFormat(): string
|
||||||
{
|
{
|
||||||
var_dump($this->format);
|
|
||||||
if ($this->format == self::HTML) {
|
if ($this->format == self::HTML) {
|
||||||
return 'text/html;charset=utf-8';
|
return 'text/html;charset=utf-8';
|
||||||
} else if ($this->format == self::XML) {
|
} else if ($this->format == self::XML) {
|
||||||
@@ -173,7 +175,6 @@ class Response extends HttpService
|
|||||||
*/
|
*/
|
||||||
public function configure(SResponse $response = null): static
|
public function configure(SResponse $response = null): static
|
||||||
{
|
{
|
||||||
var_dump($this->format);
|
|
||||||
$response->setStatusCode($this->statusCode);
|
$response->setStatusCode($this->statusCode);
|
||||||
$response->header('Content-Type', $this->getResponseFormat());
|
$response->header('Content-Type', $this->getResponseFormat());
|
||||||
$response->header('Run-Time', $this->getRuntime());
|
$response->header('Run-Time', $this->getRuntime());
|
||||||
@@ -212,7 +213,7 @@ class Response extends HttpService
|
|||||||
/**
|
/**
|
||||||
* @param mixed $content
|
* @param mixed $content
|
||||||
*/
|
*/
|
||||||
public function setContent(mixed $content, $statusCode = 200, $format = self::JSON): static
|
public function setContent(mixed $content, $statusCode = 200, $format = null): static
|
||||||
{
|
{
|
||||||
$this->endData = $content;
|
$this->endData = $content;
|
||||||
$this->setStatusCode($statusCode);
|
$this->setStatusCode($statusCode);
|
||||||
|
|||||||
+2
-1
@@ -5,6 +5,7 @@ namespace Server;
|
|||||||
|
|
||||||
|
|
||||||
use HttpServer\Http\Context;
|
use HttpServer\Http\Context;
|
||||||
|
use HttpServer\Http\Response as HttpResponse;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,7 +27,7 @@ class Response
|
|||||||
*/
|
*/
|
||||||
public function __call($name, $args)
|
public function __call($name, $args)
|
||||||
{
|
{
|
||||||
return Context::getContext(\HttpServer\Http\Response::class)->{$name}(...$args);
|
return Context::getContext(HttpResponse::class)->{$name}(...$args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user