removed proxy func, need to revist it again
This commit is contained in:
parent
eda7c79ab6
commit
f4a2452a94
18
router.go
18
router.go
@ -144,23 +144,7 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
r.mux.ServeHTTP(w, req)
|
r.mux.ServeHTTP(w, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proxy are request and
|
// TODO: proxy for aws lambda
|
||||||
func (r *Router) Proxy(w http.ResponseWriter, req *http.Request) {
|
|
||||||
if r == nil {
|
|
||||||
panic("mux: method ServeHTTP called on nil")
|
|
||||||
}
|
|
||||||
|
|
||||||
h, pattern := r.mux.Handler(req)
|
|
||||||
if pattern == "" {
|
|
||||||
http.Error(w, "Not Found", http.StatusNotFound)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure we run all the middlewares
|
|
||||||
h = stack(r.middlewares, h)
|
|
||||||
// serve
|
|
||||||
h.ServeHTTP(w, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
// stack middlewares(http handler) in order they are passed (FIFO)
|
// stack middlewares(http handler) in order they are passed (FIFO)
|
||||||
func stack(middlewares []func(http.Handler) http.Handler, endpoint http.Handler) http.Handler {
|
func stack(middlewares []func(http.Handler) http.Handler, endpoint http.Handler) http.Handler {
|
||||||
|
Loading…
Reference in New Issue
Block a user