Enable usestdlibvars linter and fix findings (#13339)

Co-authored-by: terence <terence@prysmaticlabs.com>
This commit is contained in:
Justin Traglia
2023-12-15 13:21:54 -06:00
committed by GitHub
parent d70f477b1e
commit c56abfb840
6 changed files with 13 additions and 12 deletions

View File

@@ -27,7 +27,7 @@ var Handler = func(res http.ResponseWriter, req *http.Request) {
if d, ok := _bindata[p]; ok {
m := mime.TypeByExtension(path.Ext(p))
res.Header().Add("Content-Type", m)
res.WriteHeader(200)
res.WriteHeader(http.StatusOK)
asset, err := d()
if err != nil {
log.WithError(err).Error("Failed to unwrap asset data for http response")
@@ -40,7 +40,7 @@ var Handler = func(res http.ResponseWriter, req *http.Request) {
// requesting /login, this should serve the single page app index.html.
m := mime.TypeByExtension(".html")
res.Header().Add("Content-Type", m)
res.WriteHeader(200)
res.WriteHeader(http.StatusOK)
asset, err := d()
if err != nil {
log.WithError(err).Error("Failed to unwrap asset data for http response")
@@ -50,7 +50,7 @@ var Handler = func(res http.ResponseWriter, req *http.Request) {
}
} else { // If index.html is not present, serve 404. This should never happen.
log.WithField("URI", req.RequestURI).Error("Path not found")
res.WriteHeader(404)
res.WriteHeader(http.StatusNotFound)
if _, err := res.Write([]byte("Not found")); err != nil {
log.WithError(err).Error("Failed to write http response")
}