浏览代码

pkg/authorization: use constants for http methods

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 5 年之前
父节点
当前提交
5ba167ce8a
共有 3 个文件被更改,包括 4 次插入4 次删除
  1. 1 1
      pkg/authorization/api_test.go
  2. 2 2
      pkg/authorization/authz_unix_test.go
  3. 1 1
      pkg/authorization/middleware_unix_test.go

+ 1 - 1
pkg/authorization/api_test.go

@@ -46,7 +46,7 @@ func TestPeerCertificateMarshalJSON(t *testing.T) {
 
 	var certs = []*x509.Certificate{cert}
 	addr := "www.authz.com/auth"
-	req, err := http.NewRequest("GET", addr, nil)
+	req, err := http.NewRequest(http.MethodGet, addr, nil)
 	assert.NilError(t, err)
 
 	req.RequestURI = addr

+ 2 - 2
pkg/authorization/authz_unix_test.go

@@ -38,7 +38,7 @@ func TestAuthZRequestPluginError(t *testing.T) {
 		User:           "user",
 		RequestBody:    []byte("sample body"),
 		RequestURI:     "www.authz.com/auth",
-		RequestMethod:  "GET",
+		RequestMethod:  http.MethodGet,
 		RequestHeaders: map[string]string{"header": "value"},
 	}
 	server.replayResponse = Response{
@@ -69,7 +69,7 @@ func TestAuthZRequestPlugin(t *testing.T) {
 		User:           "user",
 		RequestBody:    []byte("sample body"),
 		RequestURI:     "www.authz.com/auth",
-		RequestMethod:  "GET",
+		RequestMethod:  http.MethodGet,
 		RequestHeaders: map[string]string{"header": "value"},
 	}
 	server.replayResponse = Response{

+ 1 - 1
pkg/authorization/middleware_unix_test.go

@@ -34,7 +34,7 @@ func TestMiddlewareWrapHandler(t *testing.T) {
 	assert.Assert(t, mdHandler != nil)
 
 	addr := "www.example.com/auth"
-	req, _ := http.NewRequest("GET", addr, nil)
+	req, _ := http.NewRequest(http.MethodGet, addr, nil)
 	req.RequestURI = addr
 	req.Header.Add("header", "value")