Skip to content

Commit

Permalink
Small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Phoen committed Nov 26, 2024
1 parent 418cb93 commit 63ec973
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/grizzly/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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))
}
}

Expand Down

0 comments on commit 63ec973

Please sign in to comment.