forked from meson10/gottp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
base_handler.go
51 lines (40 loc) · 974 Bytes
/
base_handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package gottp
import "net/http"
type Handler interface {
Get(request *Request)
Put(request *Request)
Post(request *Request)
Delete(request *Request)
Head(request *Request)
Options(request *Request)
Patch(request *Request)
}
type BaseHandler struct {
name string
pattern string
}
func notImplemented(request *Request) {
e := HttpError{http.StatusNotImplemented, "Method not Implemented"}
request.Raise(e)
}
func (self *BaseHandler) Get(request *Request) {
notImplemented(request)
}
func (self *BaseHandler) Put(request *Request) {
notImplemented(request)
}
func (self *BaseHandler) Post(request *Request) {
notImplemented(request)
}
func (self *BaseHandler) Delete(request *Request) {
notImplemented(request)
}
func (self *BaseHandler) Head(request *Request) {
notImplemented(request)
}
func (self *BaseHandler) Options(request *Request) {
notImplemented(request)
}
func (self *BaseHandler) Patch(request *Request) {
notImplemented(request)
}