This commit is contained in:
parent
86f643ad0b
commit
b6119f320f
@ -26,7 +26,7 @@ func (h path) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
f()
|
f()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
badMethod(w)
|
writeJSONerror(w, "method not supported", http.StatusMethodNotAllowed)
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeJSONerror(w http.ResponseWriter, err string, status int) {
|
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) {
|
func getBooks(l Library, w http.ResponseWriter, r *http.Request) {
|
||||||
books, err := l.GetAllBooks(r.Context())
|
books, err := l.GetAllBooks(r.Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user