Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix favicon 404s triggered when using loginAs() or logout() methods #1061

Merged
merged 2 commits into from
Sep 26, 2023
Merged

Fix favicon 404s triggered when using loginAs() or logout() methods #1061

merged 2 commits into from
Sep 26, 2023

Conversation

ziadoz
Copy link
Contributor

@ziadoz ziadoz commented Sep 26, 2023

Every Dusk test that uses loginAs() or logout() appears to record the following error in tests/Browser/console:

[
    {
        "level": "SEVERE",
        "message": "https:\/\/localhost\/favicon.ico - Failed to load resource: the server responded with a status of 404 ()",
        "source": "network",
        "timestamp": 1695715357814
    }
]

The referrer for the 404 is https://localhost/_dusk/login/{id}.

It happens because the controller than handles logging in and out returns void, which is presumably treated as an empty 200 response. This causes Chrome to make an additional request to favicon.ico. Instead these methods should return a 204 no content response, which informs Chrome it doesn't need to and stops these error logs.

This bug caused me a bit of confusion, as for a while I thought my app was missing a favicon somehow when it wasn't.

@ziadoz ziadoz marked this pull request as ready for review September 26, 2023 08:12
@taylorotwell taylorotwell merged commit 076865d into laravel:7.x Sep 26, 2023
21 checks passed
@ziadoz ziadoz deleted the favicon-404-fix branch September 26, 2023 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants