fix(web): манифест PWA отдаётся с правильным типом

Go определяет .webmanifest как text/plain, из-за чего браузер мог отказаться
ставить приложение: тип задаём явно вместе с js/css/svg.
This commit is contained in:
2026-09-21 19:45:25 +03:00
parent 5afcfee744
commit dd4432452c
6 changed files with 217 additions and 1 deletions
+19
View File
@@ -785,3 +785,22 @@ func guildChannelID(t *testing.T, srv *Server, guildID string, cookie *http.Cook
t.Fatal("текстовая комната не найдена")
return ""
}
func TestStaticServesPWAAssets(t *testing.T) {
srv, _ := newTestServer(t)
// В тестовом каталоге лежит только index.html: проверяем типы по расширению.
cases := map[string]string{
"/manifest.webmanifest": "application/manifest+json",
"/sw.js": "text/javascript; charset=utf-8",
"/offline.html": "text/html; charset=utf-8",
}
for path, want := range cases {
rec := doJSON(t, srv, http.MethodGet, path, "")
if rec.Code != http.StatusOK {
t.Fatalf("%s = %d", path, rec.Code)
}
if got := rec.Header().Get("Content-Type"); got != want {
t.Fatalf("%s: Content-Type = %q, ожидался %q", path, got, want)
}
}
}