mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-26 00:12:19 +03:00
Return 501 for "not implemented". Fixes #1785
This commit is contained in:
parent
8cd405d15e
commit
9c3b14c5c4
@ -200,12 +200,12 @@ func h(r chi.Router, path string, f handler) {
|
|||||||
r.HandleFunc("/"+path+".view", handle)
|
r.HandleFunc("/"+path+".view", handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a handler that returns 510 - Not implemented. Used to signal that an endpoint is not implemented yet
|
// Add a handler that returns 501 - Not implemented. Used to signal that an endpoint is not implemented yet
|
||||||
func h501(r *chi.Mux, paths ...string) {
|
func h501(r *chi.Mux, paths ...string) {
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
handle := func(w http.ResponseWriter, r *http.Request) {
|
handle := func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Add("Cache-Control", "no-cache")
|
w.Header().Add("Cache-Control", "no-cache")
|
||||||
w.WriteHeader(510)
|
w.WriteHeader(501)
|
||||||
_, _ = w.Write([]byte("This endpoint is not implemented, but may be in future releases"))
|
_, _ = w.Write([]byte("This endpoint is not implemented, but may be in future releases"))
|
||||||
}
|
}
|
||||||
r.HandleFunc("/"+path, handle)
|
r.HandleFunc("/"+path, handle)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user