1
0
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:
Emir Ribić
2018-10-14 17:16:58 +02:00
committed by Vishal Rana
parent 059c099762
commit c8fd197fa8
33 changed files with 270 additions and 271 deletions

View File

@ -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