mirror of
https://github.com/kataras/iris.git
synced 2026-01-09 04:51:56 +00:00
add a query helper on x/sqlx sub-package and fix the example for basicauth
This commit is contained in:
@@ -2160,6 +2160,15 @@ func (ctx *Context) AbsoluteURI(s string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
userInfo := ""
|
||||
if s[0] == '@' {
|
||||
endUserInfoIdx := strings.IndexByte(s, '/')
|
||||
if endUserInfoIdx > 0 && len(s) > endUserInfoIdx {
|
||||
userInfo = s[1:endUserInfoIdx] + "@"
|
||||
s = s[endUserInfoIdx:]
|
||||
}
|
||||
}
|
||||
|
||||
if s[0] == '/' {
|
||||
scheme := ctx.request.URL.Scheme
|
||||
if scheme == "" {
|
||||
@@ -2172,7 +2181,7 @@ func (ctx *Context) AbsoluteURI(s string) string {
|
||||
|
||||
host := ctx.Host()
|
||||
|
||||
return scheme + "//" + host + path.Clean(s)
|
||||
return scheme + "//" + userInfo + host + path.Clean(s)
|
||||
}
|
||||
|
||||
if u, err := url.Parse(s); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user