File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -520,9 +520,7 @@ protected function sendHeaders() : void
520520 if ($ this ->getHeader (ResponseHeader::DATE ) === null ) {
521521 $ this ->setDate ();
522522 }
523- if ($ this ->getHeader (ResponseHeader::CONTENT_TYPE ) === null ) {
524- $ this ->negotiateContentType ();
525- }
523+ $ this ->negotiateContentType ();
526524 if ($ this ->isAutoEtag () && !$ this ->hasDownload ()) {
527525 $ this ->negotiateEtag ();
528526 }
@@ -597,8 +595,8 @@ protected function negotiateCsp() : void
597595 }
598596
599597 /**
600- * Negotiates the Content-Type header, setting the MIME type "text/html" if
601- * the response body is not empty.
598+ * Negotiates the Content-Type header (if it is not set) , setting the MIME
599+ * type "text/html" if the response body is not empty.
602600 *
603601 * If the response body is empty, it removes the Content-Type header,
604602 * and it will not appear to the client from the request.
@@ -610,6 +608,9 @@ protected function negotiateCsp() : void
610608 */
611609 protected function negotiateContentType () : void
612610 {
611+ if ($ this ->getHeader (ResponseHeader::CONTENT_TYPE ) !== null ) {
612+ return ;
613+ }
613614 if ($ this ->getBody () !== '' ) {
614615 $ this ->setContentType ('text/html ' );
615616 return ;
You can’t perform that action at this time.
0 commit comments