From 63ec973d0f890f70c3e9c9c0f0da08d69454dc10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Gomez?= Date: Sat, 16 Nov 2024 00:57:06 +0100 Subject: [PATCH] Small cleanup --- pkg/grizzly/server.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/grizzly/server.go b/pkg/grizzly/server.go index d3a636a3..2010ef58 100644 --- a/pkg/grizzly/server.go +++ b/pkg/grizzly/server.go @@ -248,7 +248,7 @@ func (s *Server) Start() error { } } - fmt.Printf("Listening on %s\n", s.URL("/")) + fmt.Printf("Listening on %s\n", s.url("/")) return http.ListenAndServe(fmt.Sprintf(":%d", s.port), r) } @@ -282,7 +282,7 @@ func (s *Server) ParseBytes(b []byte) (Resources, error) { return resources, err } -func (s *Server) URL(path string) string { +func (s *Server) url(path string) string { if len(path) == 0 || path[0] != '/' { path = "/" + path } @@ -353,9 +353,7 @@ func (s *Server) blockHandler(response string) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) - if _, err := w.Write([]byte(response)); err != nil { - log.Errorf("error writing response: %v", err) - } + httputils.Write(w, []byte(response)) } }