File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 66
77use ArrayLookup \AtLeast ;
88use Seld \JsonLint \JsonParser ;
9+ use Seld \JsonLint \ParsingException ;
910use Throwable ;
1011
1112use function is_array ;
1415function detectMessageContentType (string $ message ): string
1516{
1617 $ jsonParser = new JsonParser ();
17- return $ jsonParser ->lint ($ message ) === null
18- ? ' application/problem+json '
19- : ( strip_tags ( $ message ) === $ message ? ' text/plain ' : ' text/html ' ) ;
18+ return $ jsonParser ->lint ($ message ) instanceof ParsingException
19+ ? ( strip_tags ( $ message ) === $ message ? ' text/plain ' : ' text/html ' )
20+ : ' application/problem+json ' ;
2021}
2122
2223/**
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ public function exceptionError(Throwable $throwable): Response
9595
9696 private function showDefaultView (): Response |HtmlResponse
9797 {
98- if ($ this ->templateRenderer === null ) {
98+ if (! $ this ->templateRenderer instanceof TemplateRendererInterface ) {
9999 return $ this ->responseByConfigMessage ('no_template ' );
100100 }
101101
You can’t perform that action at this time.
0 commit comments