Skip to content

Commit cc2bb9a

Browse files
fix: loading of WebProfilerBundle’s toolbar stylesheet
1 parent 14bff67 commit cc2bb9a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/config/routing/wdt.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://symfony.com/schema/routing https://symfony.com/schema/routing/routing-1.0.xsd">
66

7-
<route id="_wdt_stylesheet" path="/styles.css">
7+
<!-- Using a path like “…/styles.css” cause issues with some web servers which try to fetch the file, and fail to do it -->
8+
<route id="_wdt_stylesheet" path="/styles-css">
89
<default key="_controller">web_profiler.controller.profiler::toolbarStylesheetAction</default>
910
</route>
1011

src/Symfony/Bundle/WebProfilerBundle/Tests/Controller/ProfilerControllerTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,20 @@ public function testToolbarStylesheetAction()
164164
$this->assertSame('max-age=600, private', $response->headers->get('Cache-Control'));
165165
}
166166

167+
public function testToolbarStylesheetActionFromPath()
168+
{
169+
$kernel = new WebProfilerBundleKernel();
170+
$client = new KernelBrowser($kernel);
171+
172+
$client->request('GET', '/_wdt/styles-css');
173+
174+
$response = $client->getResponse();
175+
176+
$this->assertSame(200, $response->getStatusCode());
177+
$this->assertSame('text/css; charset=UTF-8', $response->headers->get('Content-Type'));
178+
$this->assertSame('max-age=600, private', $response->headers->get('Cache-Control'));
179+
}
180+
167181
public static function getEmptyTokenCases()
168182
{
169183
return [

0 commit comments

Comments
 (0)