Skip to content

Commit 6f79a72

Browse files
committed
Add route for favicon.
1 parent 7070f11 commit 6f79a72

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

web/index.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Laminas\Diactoros\Request;
88
use Laminas\Diactoros\Response;
99
use Laminas\Diactoros\Response\HtmlResponse;
10+
use Laminas\Diactoros\Response\TextResponse;
1011
use Laminas\Diactoros\ServerRequestFactory;
1112
use Laminas\HttpHandlerRunner\Emitter\SapiEmitter;
1213
use League\Container\Container;
@@ -160,6 +161,14 @@
160161
// @FIXME: CORS handling, slash-adding (and possibly others?) should be added as middleware instead of "catchall" URLs map
161162

162163
/*/ Create URI groups /*/
164+
if (file_exists(__DIR__. '/favicon.ico') === false) {
165+
$router->map('GET', '/favicon.ico', static function () {
166+
return (new TextResponse(
167+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2"><circle cx="1" cy="1" r="1" fill="#FFFF00"/></svg>',
168+
))->withHeader('Content-type', 'image/svg+xml');
169+
});
170+
}
171+
163172
$router->map('GET', '/login', AddSlashToPathController::class);
164173
$router->map('GET', '/profile', AddSlashToPathController::class);
165174

0 commit comments

Comments
 (0)