1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 10:27:06 +00:00

Add history for v3.0.0.-beta.2. Some fixes to subdomains listening on local 127.0.0.1. Change GetURI to ParseURI

Examples and e-book updated also.
This commit is contained in:
Makis Maropoulos
2016-06-04 23:07:19 +03:00
parent 1a433e34d5
commit 26ef396959
10 changed files with 109 additions and 91 deletions

View File

@@ -95,18 +95,14 @@ func (ctx *Context) PostFormValue(name string) string {
return string(ctx.RequestCtx.PostArgs().Peek(name))
}
// GetSubdomain returns the subdomain if any, else empty string
func (ctx *Context) GetSubdomain() string {
if ctx.subdomain == "" {
host := ctx.HostString()
if index := strings.IndexByte(host, '.'); index > 0 {
subdomain := host[0:index]
ctx.subdomain = subdomain
}
// Subdomain returns the subdomain (string) of this request, if any
func (ctx *Context) Subdomain() (subdomain string) {
host := ctx.HostString()
if index := strings.IndexByte(host, '.'); index > 0 {
subdomain = host[0:index]
}
return ctx.subdomain
return
}
// URLEncode returns the path encoded as url