Bläddra i källkod

testutil: use constants for http methods

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 5 år sedan
förälder
incheckning
a617809fe7
2 ändrade filer med 3 tillägg och 3 borttagningar
  1. 2 2
      testutil/daemon/daemon.go
  2. 1 1
      testutil/request/request.go

+ 2 - 2
testutil/daemon/daemon.go

@@ -328,7 +328,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
 		Transport: clientConfig.transport,
 	}
 
-	req, err := http.NewRequest("GET", "/_ping", nil)
+	req, err := http.NewRequest(http.MethodGet, "/_ping", nil)
 	if err != nil {
 		return errors.Wrapf(err, "[%s] could not create new request", d.id)
 	}
@@ -683,7 +683,7 @@ func (d *Daemon) queryRootDir() (string, error) {
 		Transport: clientConfig.transport,
 	}
 
-	req, err := http.NewRequest("GET", "/info", nil)
+	req, err := http.NewRequest(http.MethodGet, "/info", nil)
 	if err != nil {
 		return "", err
 	}

+ 1 - 1
testutil/request/request.go

@@ -115,7 +115,7 @@ func newRequest(endpoint string, opts *Options) (*http.Request, error) {
 	if err != nil {
 		return nil, errors.Wrapf(err, "failed parsing url %q", opts.host)
 	}
-	req, err := http.NewRequest("GET", endpoint, nil)
+	req, err := http.NewRequest(http.MethodGet, endpoint, nil)
 	if err != nil {
 		return nil, errors.Wrap(err, "failed to create request")
 	}