1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 20:41:57 +00:00

add white box tests for transaction, response writer and some of the context's method

Former-commit-id: 67ea92337f120f03e8bb96d3daa43529b10af2f2
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-02-17 02:14:46 +02:00
parent bfeabbd74e
commit 57e5b77853
7 changed files with 545 additions and 27 deletions

View File

@@ -625,26 +625,21 @@ func (mux *serveMux) buildHandler(pool iris.ContextPool) http.Handler {
}
if mux.hosts && tree.subdomain != "" {
// context.VirtualHost() is a slow method because it makes
// string.Replaces but user can understand that if subdomain then server will have some nano/or/milleseconds performance cost
requestHost := context.VirtualHostname()
requestHost := context.Host()
hostname := context.Framework().Config.VHost
// println("mux are true and tree.subdomain= " + tree.subdomain + "and hostname = " + hostname + " host = " + requestHost)
if requestHost != hostname {
//println(requestHost + " != " + mux.hostname)
// we have a subdomain
if strings.Contains(tree.subdomain, iris.DynamicSubdomainIndicator) {
} else {
//println(requestHost + " = " + mux.hostname)
// mux.host = iris-go.com:8080, the subdomain for example is api.,
// so the host must be api.iris-go.com:8080
if tree.subdomain+hostname != requestHost {
// go to the next tree, we have a subdomain but it is not the correct
continue
}
}
} else {
//("it's subdomain but the request is the same as the listening addr mux.host == requestHost =>" + mux.host + "=" + requestHost + " ____ and tree's subdomain was: " + tree.subdomain)
//("it's subdomain but the request is not the same as the vhost)
continue
}
}