1
0
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:
Gerasimos (Makis) Maropoulos
2022-03-08 19:45:25 +02:00
parent ad80a14b8f
commit 5a7485124c
5 changed files with 75 additions and 16 deletions

View File

@@ -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 {