File tree 3 files changed +4
-2
lines changed
3 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 4
4
- 1.7.x
5
5
- 1.8.x
6
6
- 1.9.x
7
- - tip
8
7
9
8
install :
10
9
- go get -u golang.org/x/tools/cmd/goimports
Original file line number Diff line number Diff line change 6
6
"github.com/go-chi/chi"
7
7
)
8
8
9
+ // GetHead automatically route undefined HEAD requests to GET handlers.
9
10
func GetHead (next http.Handler ) http.Handler {
10
11
return http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
11
12
if r .Method == "HEAD" {
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ const (
29
29
mTRACE
30
30
)
31
31
32
- var mALL methodTyp = mCONNECT | mDELETE | mGET | mHEAD |
32
+ var mALL = mCONNECT | mDELETE | mGET | mHEAD |
33
33
mOPTIONS | mPATCH | mPOST | mPUT | mTRACE
34
34
35
35
var methodMap = map [string ]methodTyp {
@@ -44,6 +44,8 @@ var methodMap = map[string]methodTyp{
44
44
"TRACE" : mTRACE ,
45
45
}
46
46
47
+ // RegisterMethod adds support for custom HTTP method handlers, available
48
+ // via Router#Method and Router#MethodFunc
47
49
func RegisterMethod (method string ) {
48
50
if method == "" {
49
51
return
You can’t perform that action at this time.
0 commit comments