mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-20 00:40:26 +00:00
Update chi/middleware to chi/v5/middleware (#17888)
Fix #17880 Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
4646c7c52d
commit
957c3fcb59
42 changed files with 128 additions and 2572 deletions
23
vendor/github.com/go-chi/chi/middleware/middleware.go
generated
vendored
23
vendor/github.com/go-chi/chi/middleware/middleware.go
generated
vendored
|
@ -1,23 +0,0 @@
|
|||
package middleware
|
||||
|
||||
import "net/http"
|
||||
|
||||
// New will create a new middleware handler from a http.Handler.
|
||||
func New(h http.Handler) func(next http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
h.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// contextKey is a value for use with context.WithValue. It's used as
|
||||
// a pointer so it fits in an interface{} without allocation. This technique
|
||||
// for defining context keys was copied from Go 1.7's new use of context in net/http.
|
||||
type contextKey struct {
|
||||
name string
|
||||
}
|
||||
|
||||
func (k *contextKey) String() string {
|
||||
return "chi/middleware context value " + k.name
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue