Skip to content

Commit

Permalink
volume/drivers: use plugin Content-Type headers v1.2
Browse files Browse the repository at this point in the history
The MediaType was changed twice in;

- b3b7eb2 ("application/vnd.docker.plugins.v1+json"   -> "application/vnd.docker.plugins.v1.1+json")
- 54587d8 ("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 <github@gone.nl>
  • Loading branch information
thaJeztah committed Aug 7, 2023
1 parent 481dde8 commit 3e52785
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions volume/drivers/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

Expand Down

0 comments on commit 3e52785

Please sign in to comment.