1
0
mirror of https://github.com/kataras/iris.git synced 2026-03-05 16:05:58 +00:00

Add listen and proxy tests

Former-commit-id: 7c89556942af8e9c6966022323cb9746db446cfc
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-02-17 02:55:26 +02:00
parent 57e5b77853
commit 2a4997cadf
4 changed files with 324 additions and 31 deletions

View File

@@ -288,12 +288,14 @@ func Proxy(proxyAddr string, redirectSchemeAndHost string) func() error {
// override the handler and redirect all requests to this addr
h := ProxyHandler(redirectSchemeAndHost)
prx := New(OptionDisableBanner(true))
prx.Adapt(DevLogger())
prx.Adapt(RouterBuilderPolicy(func(RouteRepository, ContextPool) http.Handler {
return h
}))
go prx.Listen(proxyAddr)
time.Sleep(300 * time.Millisecond)
time.Sleep(150 * time.Millisecond)
return func() error { return prx.Close() }
}