update dependencies
This commit is contained in:
parent
fce1b99683
commit
397e9c0842
164 changed files with 5207 additions and 2213 deletions
6
vendor/github.com/go-chi/chi/CHANGELOG.md
generated
vendored
6
vendor/github.com/go-chi/chi/CHANGELOG.md
generated
vendored
|
|
@ -1,5 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
## v3.3.0 (2017-10-10)
|
||||
|
||||
- New chi.RegisterMethod(method) to add support for custom HTTP methods, see _examples/custom-method for usage
|
||||
- Deprecated LINK and UNLINK methods from the default list, please use `chi.RegisterMethod("LINK")` and `chi.RegisterMethod("UNLINK")` in an `init()` function
|
||||
|
||||
|
||||
## v3.2.1 (2017-08-31)
|
||||
|
||||
- Add new `Match(rctx *Context, method, path string) bool` method to `Routes` interface
|
||||
|
|
|
|||
2
vendor/github.com/go-chi/chi/LICENSE
generated
vendored
2
vendor/github.com/go-chi/chi/LICENSE
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2015-present Peter Kieltyka (https://github.com/pkieltyka)
|
||||
Copyright (c) 2015-present Peter Kieltyka (https://github.com/pkieltyka), Google Inc.
|
||||
|
||||
MIT License
|
||||
|
||||
|
|
|
|||
21
vendor/github.com/go-chi/chi/README.md
generated
vendored
21
vendor/github.com/go-chi/chi/README.md
generated
vendored
|
|
@ -337,16 +337,19 @@ with `net/http` can be used with chi's mux.
|
|||
| WithValue | Short-hand middleware to set a key/value on the request context |
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
### Auxiliary middlewares
|
||||
### Auxiliary middlewares & packages
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
| package | description |
|
||||
|:-------------------------------------------------|:------------------------------------------------------
|
||||
| [cors](https://github.com/go-chi/cors) | Cross-origin resource sharing (CORS) |
|
||||
| [jwtauth](https://github.com/go-chi/jwtauth) | JWT authentication |
|
||||
| [httpcoala](https://github.com/go-chi/httpcoala) | HTTP request coalescer |
|
||||
| [chi-authz](https://github.com/casbin/chi-authz) | Request ACL via https://github.com/hsluoyz/casbin |
|
||||
-----------------------------------------------------------------------------------------------------------
|
||||
Please see https://github.com/go-chi for additional packages.
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
| package | description |
|
||||
|:---------------------------------------------------|:------------------------------------------------------
|
||||
| [cors](https://github.com/go-chi/cors) | Cross-origin resource sharing (CORS) |
|
||||
| [jwtauth](https://github.com/go-chi/jwtauth) | JWT authentication |
|
||||
| [hostrouter](https://github.com/go-chi/hostrouter) | Domain/host based request routing |
|
||||
| [httpcoala](https://github.com/go-chi/httpcoala) | HTTP request coalescer |
|
||||
| [chi-authz](https://github.com/casbin/chi-authz) | Request ACL via https://github.com/hsluoyz/casbin |
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
please [submit a PR](./CONTRIBUTING.md) if you'd like to include a link to a chi-compatible middleware
|
||||
|
||||
|
|
|
|||
33
vendor/github.com/go-chi/chi/_examples/custom-method/main.go
generated
vendored
Normal file
33
vendor/github.com/go-chi/chi/_examples/custom-method/main.go
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/go-chi/chi/middleware"
|
||||
)
|
||||
|
||||
func init() {
|
||||
chi.RegisterMethod("LINK")
|
||||
chi.RegisterMethod("UNLINK")
|
||||
chi.RegisterMethod("WOOHOO")
|
||||
}
|
||||
|
||||
func main() {
|
||||
r := chi.NewRouter()
|
||||
r.Use(middleware.RequestID)
|
||||
r.Use(middleware.Logger)
|
||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("hello world"))
|
||||
})
|
||||
r.MethodFunc("LINK", "/link", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("custom link method"))
|
||||
})
|
||||
r.MethodFunc("WOOHOO", "/woo", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("custom woohoo method"))
|
||||
})
|
||||
r.HandleFunc("/everything", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("capturing all standard http methods, as well as LINK, UNLINK and WOOHOO"))
|
||||
})
|
||||
http.ListenAndServe(":3333", r)
|
||||
}
|
||||
2
vendor/github.com/go-chi/chi/middleware/closenotify18.go
generated
vendored
2
vendor/github.com/go-chi/chi/middleware/closenotify18.go
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
// +build go1.8
|
||||
// +build go1.8 appengine
|
||||
|
||||
package middleware
|
||||
|
||||
|
|
|
|||
2
vendor/github.com/go-chi/chi/middleware/compress18.go
generated
vendored
2
vendor/github.com/go-chi/chi/middleware/compress18.go
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
// +build go1.8
|
||||
// +build go1.8 appengine
|
||||
|
||||
package middleware
|
||||
|
||||
|
|
|
|||
2
vendor/github.com/go-chi/chi/middleware/wrap_writer18.go
generated
vendored
2
vendor/github.com/go-chi/chi/middleware/wrap_writer18.go
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
// +build go1.8
|
||||
// +build go1.8 appengine
|
||||
|
||||
package middleware
|
||||
|
||||
|
|
|
|||
42
vendor/github.com/go-chi/chi/tree.go
generated
vendored
42
vendor/github.com/go-chi/chi/tree.go
generated
vendored
|
|
@ -6,44 +6,59 @@ package chi
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type methodTyp int
|
||||
|
||||
const (
|
||||
mCONNECT methodTyp = 1 << iota
|
||||
mSTUB methodTyp = 1 << iota
|
||||
mCONNECT
|
||||
mDELETE
|
||||
mGET
|
||||
mHEAD
|
||||
mLINK
|
||||
mOPTIONS
|
||||
mPATCH
|
||||
mPOST
|
||||
mPUT
|
||||
mTRACE
|
||||
mUNLINK
|
||||
mSTUB
|
||||
|
||||
mALL methodTyp = mCONNECT | mDELETE | mGET | mHEAD | mLINK |
|
||||
mOPTIONS | mPATCH | mPOST | mPUT | mTRACE | mUNLINK
|
||||
)
|
||||
|
||||
var mALL methodTyp = mCONNECT | mDELETE | mGET | mHEAD |
|
||||
mOPTIONS | mPATCH | mPOST | mPUT | mTRACE
|
||||
|
||||
var methodMap = map[string]methodTyp{
|
||||
"CONNECT": mCONNECT,
|
||||
"DELETE": mDELETE,
|
||||
"GET": mGET,
|
||||
"HEAD": mHEAD,
|
||||
"LINK": mLINK,
|
||||
"OPTIONS": mOPTIONS,
|
||||
"PATCH": mPATCH,
|
||||
"POST": mPOST,
|
||||
"PUT": mPUT,
|
||||
"TRACE": mTRACE,
|
||||
"UNLINK": mUNLINK,
|
||||
}
|
||||
|
||||
func RegisterMethod(method string) {
|
||||
if method == "" {
|
||||
return
|
||||
}
|
||||
method = strings.ToUpper(method)
|
||||
if _, ok := methodMap[method]; ok {
|
||||
return
|
||||
}
|
||||
n := len(methodMap)
|
||||
if n > strconv.IntSize {
|
||||
panic(fmt.Sprintf("chi: max number of methods reached (%d)", strconv.IntSize))
|
||||
}
|
||||
mt := methodTyp(math.Exp2(float64(n)))
|
||||
methodMap[method] = mt
|
||||
mALL |= mt
|
||||
}
|
||||
|
||||
type nodeTyp uint8
|
||||
|
|
@ -676,6 +691,15 @@ func patNextSegment(pattern string) (nodeTyp, string, string, byte, int, int) {
|
|||
key = key[:idx]
|
||||
}
|
||||
|
||||
if len(rexpat) > 0 {
|
||||
if rexpat[0] != '^' {
|
||||
rexpat = "^" + rexpat
|
||||
}
|
||||
if rexpat[len(rexpat)-1] != '$' {
|
||||
rexpat = rexpat + "$"
|
||||
}
|
||||
}
|
||||
|
||||
return nt, key, rexpat, tail, ps, pe
|
||||
}
|
||||
|
||||
|
|
|
|||
25
vendor/github.com/go-chi/chi/tree_test.go
generated
vendored
25
vendor/github.com/go-chi/chi/tree_test.go
generated
vendored
|
|
@ -333,6 +333,31 @@ func TestTreeRegexp(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestTreeRegexMatchWholeParam(t *testing.T) {
|
||||
hStub1 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
|
||||
|
||||
rctx := NewRouteContext()
|
||||
tr := &node{}
|
||||
tr.InsertRoute(mGET, "/{id:[0-9]+}", hStub1)
|
||||
|
||||
tests := []struct {
|
||||
url string
|
||||
expectedHandler http.Handler
|
||||
}{
|
||||
{url: "/13", expectedHandler: hStub1},
|
||||
{url: "/a13", expectedHandler: nil},
|
||||
{url: "/13.jpg", expectedHandler: nil},
|
||||
{url: "/a13.jpg", expectedHandler: nil},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
_, _, handler := tr.FindRoute(rctx, mGET, tc.url)
|
||||
if fmt.Sprintf("%v", tc.expectedHandler) != fmt.Sprintf("%v", handler) {
|
||||
t.Errorf("expecting handler:%v , got:%v", tc.expectedHandler, handler)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestTreeFindPattern(t *testing.T) {
|
||||
hStub1 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
|
||||
hStub2 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue