mirror of
https://github.com/labstack/echo.git
synced 2025-07-05 00:58:47 +02:00
Replace http constants with stdlib ones, i.e.: http.MethodGet instead of echo.GET (#1205)
This commit is contained in:
38
router.go
38
router.go
@ -1,5 +1,7 @@
|
||||
package echo
|
||||
|
||||
import "net/http"
|
||||
|
||||
type (
|
||||
// Router is the registry of all registered routes for an `Echo` instance for
|
||||
// request matching and URL path parameter parsing.
|
||||
@ -226,50 +228,50 @@ func (n *node) findChildByKind(t kind) *node {
|
||||
|
||||
func (n *node) addHandler(method string, h HandlerFunc) {
|
||||
switch method {
|
||||
case CONNECT:
|
||||
case http.MethodConnect:
|
||||
n.methodHandler.connect = h
|
||||
case DELETE:
|
||||
case http.MethodDelete:
|
||||
n.methodHandler.delete = h
|
||||
case GET:
|
||||
case http.MethodGet:
|
||||
n.methodHandler.get = h
|
||||
case HEAD:
|
||||
case http.MethodHead:
|
||||
n.methodHandler.head = h
|
||||
case OPTIONS:
|
||||
case http.MethodOptions:
|
||||
n.methodHandler.options = h
|
||||
case PATCH:
|
||||
case http.MethodPatch:
|
||||
n.methodHandler.patch = h
|
||||
case POST:
|
||||
case http.MethodPost:
|
||||
n.methodHandler.post = h
|
||||
case PROPFIND:
|
||||
n.methodHandler.propfind = h
|
||||
case PUT:
|
||||
case http.MethodPut:
|
||||
n.methodHandler.put = h
|
||||
case TRACE:
|
||||
case http.MethodTrace:
|
||||
n.methodHandler.trace = h
|
||||
}
|
||||
}
|
||||
|
||||
func (n *node) findHandler(method string) HandlerFunc {
|
||||
switch method {
|
||||
case CONNECT:
|
||||
case http.MethodConnect:
|
||||
return n.methodHandler.connect
|
||||
case DELETE:
|
||||
case http.MethodDelete:
|
||||
return n.methodHandler.delete
|
||||
case GET:
|
||||
case http.MethodGet:
|
||||
return n.methodHandler.get
|
||||
case HEAD:
|
||||
case http.MethodHead:
|
||||
return n.methodHandler.head
|
||||
case OPTIONS:
|
||||
case http.MethodOptions:
|
||||
return n.methodHandler.options
|
||||
case PATCH:
|
||||
case http.MethodPatch:
|
||||
return n.methodHandler.patch
|
||||
case POST:
|
||||
case http.MethodPost:
|
||||
return n.methodHandler.post
|
||||
case PROPFIND:
|
||||
return n.methodHandler.propfind
|
||||
case PUT:
|
||||
case http.MethodPut:
|
||||
return n.methodHandler.put
|
||||
case TRACE:
|
||||
case http.MethodTrace:
|
||||
return n.methodHandler.trace
|
||||
default:
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user