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

New feature: versioning.Aliases

Thanks @mulyawansentosa and @remopavithran for your donates ❤️
This commit is contained in:
Gerasimos (Makis) Maropoulos
2021-01-06 01:52:39 +02:00
parent 7aa2d1f9d5
commit b409f7807e
28 changed files with 396 additions and 85 deletions

View File

@@ -64,14 +64,11 @@ func main() {
}
func handler(ctx iris.Context) {
// username, password, _ := ctx.Request().BasicAuth()
// third parameter it will be always true because the middleware
// makes sure for that, otherwise this handler will not be executed.
// OR:
user := ctx.User()
// OR ctx.User().GetRaw() to get the underline value.
username, _ := user.GetUsername()
password, _ := user.GetPassword()
// user := ctx.User().(*myUserType)
// or ctx.User().GetRaw().(*myUserType)
// ctx.Writef("%s %s:%s", ctx.Path(), user.Username, user.Password)
// OR if you don't have registered custom User structs:
username, password, _ := ctx.Request().BasicAuth()
ctx.Writef("%s %s:%s", ctx.Path(), username, password)
}