This commit is contained in:
as2252258@163.com
2021-08-04 02:19:17 +08:00
parent 9e65b23120
commit 2e97b91c13
3 changed files with 9 additions and 5 deletions
+4 -1
View File
@@ -157,8 +157,11 @@ class Response extends HttpService
* @return bool
* @throws Exception
*/
public function getBuilder(mixed $data, SResponse $response): static
public function getBuilder(mixed $data, SResponse $response = null): static
{
if ($response === null) {
return $this->setContent($data);
}
$response->setStatusCode($this->statusCode);
if (!isset($response->header['Content-Type'])) {
$response->header('Content-Type', $this->getResponseFormat());