Vendor dependencies

This commit is contained in:
Alexander Neumann
2016-12-28 21:41:04 +01:00
committed by Zlatko Čalušić
parent 2f0a16d8b7
commit 6054876201
541 changed files with 139974 additions and 0 deletions

33
vendor/goji.io/router_simple.go generated vendored Normal file
View File

@@ -0,0 +1,33 @@
// +build goji_router_simple
package goji
import "net/http"
/*
This is the simplest correct router implementation for Goji.
*/
type router []route
type route struct {
Pattern
http.Handler
}
func (rt *router) add(p Pattern, h http.Handler) {
*rt = append(*rt, route{p, h})
}
func (rt *router) route(r *http.Request) *http.Request {
for _, route := range *rt {
if r2 := route.Match(r); r2 != nil {
return r2.WithContext(&match{
Context: r2.Context(),
p: route.Pattern,
h: route.Handler,
})
}
}
return r.WithContext(&match{Context: r.Context()})
}