Fix duplicate content-type definition (#5481)

This commit is contained in:
沈唁 2023-03-06 17:30:11 +08:00 committed by GitHub
parent 0db2351130
commit 41fe521084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,7 +200,11 @@ class CoreMiddleware implements CoreMiddlewareInterface
->withBody(new SwooleStream((string) $response));
}
return $this->response()->withAddedHeader('content-type', 'text/plain')->withBody(new SwooleStream((string) $response));
if ($this->response()->hasHeader('content-type')) {
return $this->response()->withBody(new SwooleStream((string) $response));
}
return $this->response()->withHeader('content-type', 'text/plain')->withBody(new SwooleStream((string) $response));
}
/**