diff --git a/http/sys_mount.go b/http/sys_mount.go index 36499cfabf..68eae02e41 100644 --- a/http/sys_mount.go +++ b/http/sys_mount.go @@ -13,7 +13,7 @@ func handleSysMounts(core *vault.Core) http.Handler { switch r.Method { case "GET": handleSysListMounts(core).ServeHTTP(w, r) - case "POST": + case "PUT", "POST": fallthrough case "DELETE": handleSysMountUnmount(core, w, r) @@ -27,8 +27,7 @@ func handleSysMounts(core *vault.Core) http.Handler { func handleSysRemount(core *vault.Core) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { switch r.Method { - case "POST": - case "PUT": + case "PUT", "POST": default: respondError(w, http.StatusMethodNotAllowed, nil) return @@ -80,7 +79,7 @@ func handleSysListMounts(core *vault.Core) http.Handler { func handleSysMountUnmount(core *vault.Core, w http.ResponseWriter, r *http.Request) { switch r.Method { - case "POST": + case "PUT", "POST": case "DELETE": default: respondError(w, http.StatusMethodNotAllowed, nil) @@ -100,7 +99,7 @@ func handleSysMountUnmount(core *vault.Core, w http.ResponseWriter, r *http.Requ } switch r.Method { - case "POST": + case "PUT", "POST": handleSysMount(core, w, r, path) case "DELETE": handleSysUnmount(core, w, r, path) diff --git a/http/sys_mount_test.go b/http/sys_mount_test.go index c91cd66024..9e7a943405 100644 --- a/http/sys_mount_test.go +++ b/http/sys_mount_test.go @@ -76,6 +76,22 @@ func TestSysMount(t *testing.T) { } } +func TestSysMount_put(t *testing.T) { + core, _, token := vault.TestCoreUnsealed(t) + ln, addr := TestServer(t, core) + defer ln.Close() + TestServerAuth(t, addr, token) + + resp := testHttpPut(t, addr+"/v1/sys/mounts/foo", map[string]interface{}{ + "type": "generic", + "description": "foo", + }) + testResponseStatus(t, resp, 204) + + // The TestSysMount test tests the thing is actually created. See that test + // for more info. +} + func TestSysRemount(t *testing.T) { core, _, token := vault.TestCoreUnsealed(t) ln, addr := TestServer(t, core)