From 3e52785aae3e9e2121e8506628eee47ccb6811db Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 19 Jul 2023 10:26:38 +0200 Subject: [PATCH] volume/drivers: use plugin Content-Type headers v1.2 The MediaType was changed twice in; - b3b7eb2723461b1eb4be692f4bced0ae8ea9cb58 ("application/vnd.docker.plugins.v1+json" -> "application/vnd.docker.plugins.v1.1+json") - 54587d861d6664d6d32bc62a46c0c7ea0c7853e6 ("application/vnd.docker.plugins.v1.1+json" -> "application/vnd.docker.plugins.v1.2+json") But the (integration) tests were still using the old version, so let's use the VersionMimeType const that's defined, and use the updated version. Signed-off-by: Sebastiaan van Stijn --- volume/drivers/proxy_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/volume/drivers/proxy_test.go b/volume/drivers/proxy_test.go index 79af956333f98..7fef62f2dc4b4 100644 --- a/volume/drivers/proxy_test.go +++ b/volume/drivers/proxy_test.go @@ -18,42 +18,42 @@ func TestVolumeRequestError(t *testing.T) { defer server.Close() mux.HandleFunc("/VolumeDriver.Create", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") + w.Header().Set("Content-Type", plugins.VersionMimetype) fmt.Fprintln(w, `{"Err": "Cannot create volume"}`) }) mux.HandleFunc("/VolumeDriver.Remove", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") + w.Header().Set("Content-Type", plugins.VersionMimetype) fmt.Fprintln(w, `{"Err": "Cannot remove volume"}`) }) mux.HandleFunc("/VolumeDriver.Mount", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") + w.Header().Set("Content-Type", plugins.VersionMimetype) fmt.Fprintln(w, `{"Err": "Cannot mount volume"}`) }) mux.HandleFunc("/VolumeDriver.Unmount", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") + w.Header().Set("Content-Type", plugins.VersionMimetype) fmt.Fprintln(w, `{"Err": "Cannot unmount volume"}`) }) mux.HandleFunc("/VolumeDriver.Path", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") + w.Header().Set("Content-Type", plugins.VersionMimetype) fmt.Fprintln(w, `{"Err": "Unknown volume"}`) }) mux.HandleFunc("/VolumeDriver.List", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") + w.Header().Set("Content-Type", plugins.VersionMimetype) fmt.Fprintln(w, `{"Err": "Cannot list volumes"}`) }) mux.HandleFunc("/VolumeDriver.Get", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") + w.Header().Set("Content-Type", plugins.VersionMimetype) fmt.Fprintln(w, `{"Err": "Cannot get volume"}`) }) mux.HandleFunc("/VolumeDriver.Capabilities", func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json") + w.Header().Set("Content-Type", plugins.VersionMimetype) http.Error(w, "error", 500) })