mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
pkg/plugins: use constants for http methods
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
5ba167ce8a
commit
aa655a4d73
4 changed files with 7 additions and 7 deletions
|
@ -70,7 +70,7 @@ func TestEchoInputOutput(t *testing.T) {
|
||||||
m := Manifest{[]string{"VolumeDriver", "NetworkDriver"}}
|
m := Manifest{[]string{"VolumeDriver", "NetworkDriver"}}
|
||||||
|
|
||||||
mux.HandleFunc("/Test.Echo", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/Test.Echo", func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != "POST" {
|
if r.Method != http.MethodPost {
|
||||||
t.Fatalf("Expected POST, got %s\n", r.Method)
|
t.Fatalf("Expected POST, got %s\n", r.Method)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ func TestClientStream(t *testing.T) {
|
||||||
var output Manifest
|
var output Manifest
|
||||||
|
|
||||||
mux.HandleFunc("/Test.Echo", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/Test.Echo", func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != "POST" {
|
if r.Method != http.MethodPost {
|
||||||
t.Fatalf("Expected POST, got %s", r.Method)
|
t.Fatalf("Expected POST, got %s", r.Method)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ func TestClientSendFile(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
mux.HandleFunc("/Test.Echo", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/Test.Echo", func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != "POST" {
|
if r.Method != http.MethodPost {
|
||||||
t.Fatalf("Expected POST, got %s\n", r.Method)
|
t.Fatalf("Expected POST, got %s\n", r.Method)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ type testRequestWrapper struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *testRequestWrapper) NewRequest(path string, data io.Reader) (*http.Request, error) {
|
func (w *testRequestWrapper) NewRequest(path string, data io.Reader) (*http.Request, error) {
|
||||||
req, err := http.NewRequest("POST", path, data)
|
req, err := http.NewRequest(http.MethodPost, path, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ func TestPluginWithNoManifest(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/Plugin.Activate", func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method != "POST" {
|
if r.Method != http.MethodPost {
|
||||||
t.Fatalf("Expected POST, got %s\n", r.Method)
|
t.Fatalf("Expected POST, got %s\n", r.Method)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,5 +17,5 @@ func TestHTTPTransport(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
assert.Check(t, is.Equal("POST", request.Method))
|
assert.Check(t, is.Equal(http.MethodPost, request.Method))
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ func newHTTPRequest(path string, data io.Reader) (*http.Request, error) {
|
||||||
if !strings.HasPrefix(path, "/") {
|
if !strings.HasPrefix(path, "/") {
|
||||||
path = "/" + path
|
path = "/" + path
|
||||||
}
|
}
|
||||||
req, err := http.NewRequest("POST", path, data)
|
req, err := http.NewRequest(http.MethodPost, path, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue