mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
Added PROPFIND method
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
27b5253bfd
commit
bdb49be734
20
echo.go
20
echo.go
@ -129,15 +129,16 @@ type (
|
|||||||
|
|
||||||
// HTTP methods
|
// HTTP methods
|
||||||
const (
|
const (
|
||||||
CONNECT = "CONNECT"
|
CONNECT = "CONNECT"
|
||||||
DELETE = "DELETE"
|
DELETE = "DELETE"
|
||||||
GET = "GET"
|
GET = "GET"
|
||||||
HEAD = "HEAD"
|
HEAD = "HEAD"
|
||||||
OPTIONS = "OPTIONS"
|
OPTIONS = "OPTIONS"
|
||||||
PATCH = "PATCH"
|
PATCH = "PATCH"
|
||||||
POST = "POST"
|
POST = "POST"
|
||||||
PUT = "PUT"
|
PROPFIND = "PROPFIND"
|
||||||
TRACE = "TRACE"
|
PUT = "PUT"
|
||||||
|
TRACE = "TRACE"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MIME types
|
// MIME types
|
||||||
@ -239,6 +240,7 @@ var (
|
|||||||
OPTIONS,
|
OPTIONS,
|
||||||
PATCH,
|
PATCH,
|
||||||
POST,
|
POST,
|
||||||
|
PROPFIND,
|
||||||
PUT,
|
PUT,
|
||||||
TRACE,
|
TRACE,
|
||||||
}
|
}
|
||||||
|
79
router.go
79
router.go
@ -21,15 +21,16 @@ type (
|
|||||||
kind uint8
|
kind uint8
|
||||||
children []*node
|
children []*node
|
||||||
methodHandler struct {
|
methodHandler struct {
|
||||||
connect HandlerFunc
|
connect HandlerFunc
|
||||||
delete HandlerFunc
|
delete HandlerFunc
|
||||||
get HandlerFunc
|
get HandlerFunc
|
||||||
head HandlerFunc
|
head HandlerFunc
|
||||||
options HandlerFunc
|
options HandlerFunc
|
||||||
patch HandlerFunc
|
patch HandlerFunc
|
||||||
post HandlerFunc
|
post HandlerFunc
|
||||||
put HandlerFunc
|
propfind HandlerFunc
|
||||||
trace HandlerFunc
|
put HandlerFunc
|
||||||
|
trace HandlerFunc
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -225,22 +226,24 @@ func (n *node) findChildByKind(t kind) *node {
|
|||||||
|
|
||||||
func (n *node) addHandler(method string, h HandlerFunc) {
|
func (n *node) addHandler(method string, h HandlerFunc) {
|
||||||
switch method {
|
switch method {
|
||||||
case GET:
|
|
||||||
n.methodHandler.get = h
|
|
||||||
case POST:
|
|
||||||
n.methodHandler.post = h
|
|
||||||
case PUT:
|
|
||||||
n.methodHandler.put = h
|
|
||||||
case DELETE:
|
|
||||||
n.methodHandler.delete = h
|
|
||||||
case PATCH:
|
|
||||||
n.methodHandler.patch = h
|
|
||||||
case OPTIONS:
|
|
||||||
n.methodHandler.options = h
|
|
||||||
case HEAD:
|
|
||||||
n.methodHandler.head = h
|
|
||||||
case CONNECT:
|
case CONNECT:
|
||||||
n.methodHandler.connect = h
|
n.methodHandler.connect = h
|
||||||
|
case DELETE:
|
||||||
|
n.methodHandler.delete = h
|
||||||
|
case GET:
|
||||||
|
n.methodHandler.get = h
|
||||||
|
case HEAD:
|
||||||
|
n.methodHandler.head = h
|
||||||
|
case OPTIONS:
|
||||||
|
n.methodHandler.options = h
|
||||||
|
case PATCH:
|
||||||
|
n.methodHandler.patch = h
|
||||||
|
case POST:
|
||||||
|
n.methodHandler.post = h
|
||||||
|
case PROPFIND:
|
||||||
|
n.methodHandler.propfind = h
|
||||||
|
case PUT:
|
||||||
|
n.methodHandler.put = h
|
||||||
case TRACE:
|
case TRACE:
|
||||||
n.methodHandler.trace = h
|
n.methodHandler.trace = h
|
||||||
}
|
}
|
||||||
@ -248,22 +251,24 @@ func (n *node) addHandler(method string, h HandlerFunc) {
|
|||||||
|
|
||||||
func (n *node) findHandler(method string) HandlerFunc {
|
func (n *node) findHandler(method string) HandlerFunc {
|
||||||
switch method {
|
switch method {
|
||||||
case GET:
|
|
||||||
return n.methodHandler.get
|
|
||||||
case POST:
|
|
||||||
return n.methodHandler.post
|
|
||||||
case PUT:
|
|
||||||
return n.methodHandler.put
|
|
||||||
case DELETE:
|
|
||||||
return n.methodHandler.delete
|
|
||||||
case PATCH:
|
|
||||||
return n.methodHandler.patch
|
|
||||||
case OPTIONS:
|
|
||||||
return n.methodHandler.options
|
|
||||||
case HEAD:
|
|
||||||
return n.methodHandler.head
|
|
||||||
case CONNECT:
|
case CONNECT:
|
||||||
return n.methodHandler.connect
|
return n.methodHandler.connect
|
||||||
|
case DELETE:
|
||||||
|
return n.methodHandler.delete
|
||||||
|
case GET:
|
||||||
|
return n.methodHandler.get
|
||||||
|
case HEAD:
|
||||||
|
return n.methodHandler.head
|
||||||
|
case OPTIONS:
|
||||||
|
return n.methodHandler.options
|
||||||
|
case PATCH:
|
||||||
|
return n.methodHandler.patch
|
||||||
|
case POST:
|
||||||
|
return n.methodHandler.post
|
||||||
|
case PROPFIND:
|
||||||
|
return n.methodHandler.propfind
|
||||||
|
case PUT:
|
||||||
|
return n.methodHandler.put
|
||||||
case TRACE:
|
case TRACE:
|
||||||
return n.methodHandler.trace
|
return n.methodHandler.trace
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user