Skip to content

Commit bdb49be

Browse files
committed
Added PROPFIND method
Signed-off-by: Vishal Rana <vr@labstack.com>
1 parent 27b5253 commit bdb49be

File tree

2 files changed

+45
-38
lines changed

2 files changed

+45
-38
lines changed

echo.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,16 @@ type (
129129

130130
// HTTP methods
131131
const (
132-
CONNECT = "CONNECT"
133-
DELETE = "DELETE"
134-
GET = "GET"
135-
HEAD = "HEAD"
136-
OPTIONS = "OPTIONS"
137-
PATCH = "PATCH"
138-
POST = "POST"
139-
PUT = "PUT"
140-
TRACE = "TRACE"
132+
CONNECT = "CONNECT"
133+
DELETE = "DELETE"
134+
GET = "GET"
135+
HEAD = "HEAD"
136+
OPTIONS = "OPTIONS"
137+
PATCH = "PATCH"
138+
POST = "POST"
139+
PROPFIND = "PROPFIND"
140+
PUT = "PUT"
141+
TRACE = "TRACE"
141142
)
142143

143144
// MIME types
@@ -239,6 +240,7 @@ var (
239240
OPTIONS,
240241
PATCH,
241242
POST,
243+
PROPFIND,
242244
PUT,
243245
TRACE,
244246
}

router.go

+34-29
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ type (
2121
kind uint8
2222
children []*node
2323
methodHandler struct {
24-
connect HandlerFunc
25-
delete HandlerFunc
26-
get HandlerFunc
27-
head HandlerFunc
28-
options HandlerFunc
29-
patch HandlerFunc
30-
post HandlerFunc
31-
put HandlerFunc
32-
trace HandlerFunc
24+
connect HandlerFunc
25+
delete HandlerFunc
26+
get HandlerFunc
27+
head HandlerFunc
28+
options HandlerFunc
29+
patch HandlerFunc
30+
post HandlerFunc
31+
propfind HandlerFunc
32+
put HandlerFunc
33+
trace HandlerFunc
3334
}
3435
)
3536

@@ -225,45 +226,49 @@ func (n *node) findChildByKind(t kind) *node {
225226

226227
func (n *node) addHandler(method string, h HandlerFunc) {
227228
switch method {
229+
case CONNECT:
230+
n.methodHandler.connect = h
231+
case DELETE:
232+
n.methodHandler.delete = h
228233
case GET:
229234
n.methodHandler.get = h
235+
case HEAD:
236+
n.methodHandler.head = h
237+
case OPTIONS:
238+
n.methodHandler.options = h
239+
case PATCH:
240+
n.methodHandler.patch = h
230241
case POST:
231242
n.methodHandler.post = h
243+
case PROPFIND:
244+
n.methodHandler.propfind = h
232245
case PUT:
233246
n.methodHandler.put = h
234-
case DELETE:
235-
n.methodHandler.delete = h
236-
case PATCH:
237-
n.methodHandler.patch = h
238-
case OPTIONS:
239-
n.methodHandler.options = h
240-
case HEAD:
241-
n.methodHandler.head = h
242-
case CONNECT:
243-
n.methodHandler.connect = h
244247
case TRACE:
245248
n.methodHandler.trace = h
246249
}
247250
}
248251

249252
func (n *node) findHandler(method string) HandlerFunc {
250253
switch method {
254+
case CONNECT:
255+
return n.methodHandler.connect
256+
case DELETE:
257+
return n.methodHandler.delete
251258
case GET:
252259
return n.methodHandler.get
260+
case HEAD:
261+
return n.methodHandler.head
262+
case OPTIONS:
263+
return n.methodHandler.options
264+
case PATCH:
265+
return n.methodHandler.patch
253266
case POST:
254267
return n.methodHandler.post
268+
case PROPFIND:
269+
return n.methodHandler.propfind
255270
case PUT:
256271
return n.methodHandler.put
257-
case DELETE:
258-
return n.methodHandler.delete
259-
case PATCH:
260-
return n.methodHandler.patch
261-
case OPTIONS:
262-
return n.methodHandler.options
263-
case HEAD:
264-
return n.methodHandler.head
265-
case CONNECT:
266-
return n.methodHandler.connect
267272
case TRACE:
268273
return n.methodHandler.trace
269274
default:

0 commit comments

Comments
 (0)