From b6119f320f11d66ce3be727dac192a61530b6b4e Mon Sep 17 00:00:00 2001 From: David Ashby Date: Tue, 2 Jan 2024 20:53:59 -0500 Subject: [PATCH] inline func --- cmd/serve/api.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd/serve/api.go b/cmd/serve/api.go index 6d03a4a..df8ce9f 100644 --- a/cmd/serve/api.go +++ b/cmd/serve/api.go @@ -26,7 +26,7 @@ func (h path) ServeHTTP(w http.ResponseWriter, r *http.Request) { f() return } - badMethod(w) + writeJSONerror(w, "method not supported", http.StatusMethodNotAllowed) } func writeJSONerror(w http.ResponseWriter, err string, status int) { @@ -87,10 +87,6 @@ func (router *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) { } } -func badMethod(w http.ResponseWriter) { - writeJSONerror(w, "method not supported", http.StatusMethodNotAllowed) -} - func getBooks(l Library, w http.ResponseWriter, r *http.Request) { books, err := l.GetAllBooks(r.Context()) if err != nil {