mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
Merge pull request #1727 from lucassabreu/add-utf8-charset
(feat): add utf-8 charset to response
This commit is contained in:
commit
00e4b53802
@ -65,10 +65,12 @@ final class SwaggerUiController
|
|||||||
$spec['basePath'] = $request->getBaseUrl();
|
$spec['basePath'] = $request->getBaseUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Response(
|
$response = new Response(
|
||||||
$this->twig->render('@NelmioApiDoc/SwaggerUi/index.html.twig', ['swagger_data' => ['spec' => $spec]]),
|
$this->twig->render('@NelmioApiDoc/SwaggerUi/index.html.twig', ['swagger_data' => ['spec' => $spec]]),
|
||||||
Response::HTTP_OK,
|
Response::HTTP_OK,
|
||||||
['Content-Type' => 'text/html']
|
['Content-Type' => 'text/html']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return $response->setCharset('UTF-8');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ class SwaggerUiTest extends WebTestCase
|
|||||||
|
|
||||||
$response = $this->client->getResponse();
|
$response = $this->client->getResponse();
|
||||||
$this->assertEquals(200, $response->getStatusCode());
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
$this->assertEquals('text/html; charset=UTF-8', $response->headers->get('Content-Type'));
|
$this->assertEquals('text/html; charset=UTF-8', $response->headers->get('Content-Type'));
|
||||||
|
|
||||||
$expected = $this->getSwaggerDefinition()->toArray();
|
$expected = $this->getSwaggerDefinition()->toArray();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user