14345: Support PROPPATCH method.
authorTom Clegg <tclegg@veritasgenetics.com>
Wed, 21 Nov 2018 16:46:34 +0000 (11:46 -0500)
committerTom Clegg <tclegg@veritasgenetics.com>
Wed, 21 Nov 2018 16:46:34 +0000 (11:46 -0500)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

services/keep-web/handler.go
services/keep-web/handler_test.go

index 6aeb7b9c48dfb2859841c72f19e2ff78c282e5aa..6a7dc5dbacb7840cc759bb1447803b8d56aed726 100644 (file)
@@ -141,26 +141,28 @@ var (
                "Depth", "Destination", "If", "Lock-Token", "Overwrite", "Timeout",
        }, ", ")
        writeMethod = map[string]bool{
-               "COPY":   true,
-               "DELETE": true,
-               "LOCK":   true,
-               "MKCOL":  true,
-               "MOVE":   true,
-               "PUT":    true,
-               "RMCOL":  true,
-               "UNLOCK": true,
+               "COPY":      true,
+               "DELETE":    true,
+               "LOCK":      true,
+               "MKCOL":     true,
+               "MOVE":      true,
+               "PROPPATCH": true,
+               "PUT":       true,
+               "RMCOL":     true,
+               "UNLOCK":    true,
        }
        webdavMethod = map[string]bool{
-               "COPY":     true,
-               "DELETE":   true,
-               "LOCK":     true,
-               "MKCOL":    true,
-               "MOVE":     true,
-               "OPTIONS":  true,
-               "PROPFIND": true,
-               "PUT":      true,
-               "RMCOL":    true,
-               "UNLOCK":   true,
+               "COPY":      true,
+               "DELETE":    true,
+               "LOCK":      true,
+               "MKCOL":     true,
+               "MOVE":      true,
+               "OPTIONS":   true,
+               "PROPFIND":  true,
+               "PROPPATCH": true,
+               "PUT":       true,
+               "RMCOL":     true,
+               "UNLOCK":    true,
        }
        browserMethod = map[string]bool{
                "GET":  true,
@@ -216,7 +218,7 @@ func (h *handler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
                        return
                }
                w.Header().Set("Access-Control-Allow-Headers", corsAllowHeadersHeader)
-               w.Header().Set("Access-Control-Allow-Methods", "COPY, DELETE, GET, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PUT, RMCOL")
+               w.Header().Set("Access-Control-Allow-Methods", "COPY, DELETE, GET, LOCK, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PROPPATCH, PUT, RMCOL, UNLOCK")
                w.Header().Set("Access-Control-Allow-Origin", "*")
                w.Header().Set("Access-Control-Max-Age", "86400")
                statusCode = http.StatusOK
index 39fb87fbaa5f6f0de5aee86258114b10b6df8e6e..7a015c91f9d07b56926dd480e0b30f47149af1c8 100644 (file)
@@ -47,7 +47,7 @@ func (s *UnitSuite) TestCORSPreflight(c *check.C) {
        c.Check(resp.Code, check.Equals, http.StatusOK)
        c.Check(resp.Body.String(), check.Equals, "")
        c.Check(resp.Header().Get("Access-Control-Allow-Origin"), check.Equals, "*")
-       c.Check(resp.Header().Get("Access-Control-Allow-Methods"), check.Equals, "COPY, DELETE, GET, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PUT, RMCOL")
+       c.Check(resp.Header().Get("Access-Control-Allow-Methods"), check.Equals, "COPY, DELETE, GET, LOCK, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PROPPATCH, PUT, RMCOL, UNLOCK")
        c.Check(resp.Header().Get("Access-Control-Allow-Headers"), check.Equals, "Authorization, Content-Type, Range, Depth, Destination, If, Lock-Token, Overwrite, Timeout")
 
        // Check preflight for a disallowed request