改名
This commit is contained in:
@@ -15,7 +15,6 @@ use HttpServer\Http\Formatter\HtmlFormatter;
|
|||||||
use HttpServer\Http\Formatter\JsonFormatter;
|
use HttpServer\Http\Formatter\JsonFormatter;
|
||||||
use HttpServer\Http\Formatter\XmlFormatter;
|
use HttpServer\Http\Formatter\XmlFormatter;
|
||||||
use HttpServer\IInterface\IFormatter;
|
use HttpServer\IInterface\IFormatter;
|
||||||
use JetBrains\PhpStorm\Pure;
|
|
||||||
use Snowflake\Core\Help;
|
use Snowflake\Core\Help;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
use Swoole\Http\Response as SResponse;
|
use Swoole\Http\Response as SResponse;
|
||||||
@@ -56,7 +55,15 @@ class Response extends HttpService
|
|||||||
*/
|
*/
|
||||||
public function setFormat($format): static
|
public function setFormat($format): static
|
||||||
{
|
{
|
||||||
$this->format = $format;
|
/** @var SResponse $response */
|
||||||
|
$response = Context::getContext(SResponse::class);
|
||||||
|
if ($format == self::HTML) {
|
||||||
|
$response->header('Content-Type', 'text/html;charset=utf-8');
|
||||||
|
} else if ($format == self::XML) {
|
||||||
|
$response->header('Content-Type', 'application/xml;charset=utf-8');
|
||||||
|
} else {
|
||||||
|
$response->header('Content-Type', 'application/json;charset=utf-8');
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +242,6 @@ class Response extends HttpService
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $url
|
* @param $url
|
||||||
* @param array $param
|
* @param array $param
|
||||||
|
|||||||
Reference in New Issue
Block a user