Minify html on-the-fly before sending it to users

This commit is contained in:
Tom Wiesing 2023-01-04 12:45:33 +01:00
parent b3039768af
commit 785130dc36
No known key found for this signature in database
7 changed files with 66 additions and 6 deletions

View file

@ -72,6 +72,6 @@ var (
return json.Marshal(map[string]any{"status": text, "code": code})
})
HTMLInterceptor = StatusInterceptor("text/html", func(code int, text string) ([]byte, error) {
return []byte(`<!DOCTYPE HTML><title>` + text + `</title>` + text), nil
return MinifyHTML([]byte(`<!DOCTYPE HTML><title>` + text + `</title>` + text)), nil
})
)