mirror of
https://github.com/rclone/rclone
synced 2025-03-30 15:56:10 +02:00
lib/http: add default 404 handler
This commit is contained in:
parent
35a86193b7
commit
e489a101f6
@ -173,6 +173,9 @@ func NewServer(listeners, tlsListeners []net.Listener, opt Options) (Server, err
|
|||||||
router.MethodNotAllowed(func(w http.ResponseWriter, _ *http.Request) {
|
router.MethodNotAllowed(func(w http.ResponseWriter, _ *http.Request) {
|
||||||
http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
|
http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
|
||||||
})
|
})
|
||||||
|
router.NotFound(func(w http.ResponseWriter, _ *http.Request) {
|
||||||
|
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
|
||||||
|
})
|
||||||
|
|
||||||
handler := router.(http.Handler)
|
handler := router.(http.Handler)
|
||||||
if opt.BaseURL != "" {
|
if opt.BaseURL != "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user