summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Vass <tiborvass@users.noreply.github.com>2019-12-19 17:57:47 +0100
committerGitHub <noreply@github.com>2019-12-19 17:57:47 +0100
commita9416c67da9fdacefa909d86e9271aeb6a9a9f05 (patch)
tree60d457373e8b1a442546dc255c1e61f1b1b870ac
parent3f2d1eb95de61a1a8cfcd1ffdea837cc868c7953 (diff)
parent90aa0901da11582da7639cc1ab202260183799e0 (diff)
downloaddocker-a9416c67da9fdacefa909d86e9271aeb6a9a9f05.tar.gz
Merge pull request #40259 from thaJeztah/more_constants
api/server/router: use consts for HTTP methods
-rw-r--r--api/server/router/local.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/api/server/router/local.go b/api/server/router/local.go
index 3f629e8e4e..f85d2f96e7 100644
--- a/api/server/router/local.go
+++ b/api/server/router/local.go
@@ -1,6 +1,8 @@
package router // import "github.com/docker/docker/api/server/router"
import (
+ "net/http"
+
"github.com/docker/docker/api/server/httputils"
)
@@ -42,30 +44,30 @@ func NewRoute(method, path string, handler httputils.APIFunc, opts ...RouteWrapp
// NewGetRoute initializes a new route with the http method GET.
func NewGetRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
- return NewRoute("GET", path, handler, opts...)
+ return NewRoute(http.MethodGet, path, handler, opts...)
}
// NewPostRoute initializes a new route with the http method POST.
func NewPostRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
- return NewRoute("POST", path, handler, opts...)
+ return NewRoute(http.MethodPost, path, handler, opts...)
}
// NewPutRoute initializes a new route with the http method PUT.
func NewPutRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
- return NewRoute("PUT", path, handler, opts...)
+ return NewRoute(http.MethodPut, path, handler, opts...)
}
// NewDeleteRoute initializes a new route with the http method DELETE.
func NewDeleteRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
- return NewRoute("DELETE", path, handler, opts...)
+ return NewRoute(http.MethodDelete, path, handler, opts...)
}
// NewOptionsRoute initializes a new route with the http method OPTIONS.
func NewOptionsRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
- return NewRoute("OPTIONS", path, handler, opts...)
+ return NewRoute(http.MethodOptions, path, handler, opts...)
}
// NewHeadRoute initializes a new route with the http method HEAD.
func NewHeadRoute(path string, handler httputils.APIFunc, opts ...RouteWrapper) Route {
- return NewRoute("HEAD", path, handler, opts...)
+ return NewRoute(http.MethodHead, path, handler, opts...)
}