forked from mirror/gin
Fixes BasicAuth test in example_basic.go
This commit is contained in:
parent
fa80b047f9
commit
9efd207a04
|
@ -33,12 +33,12 @@ func main() {
|
||||||
// "manu": "123",
|
// "manu": "123",
|
||||||
//}))
|
//}))
|
||||||
authorized := r.Group("/", gin.BasicAuth(gin.Accounts{
|
authorized := r.Group("/", gin.BasicAuth(gin.Accounts{
|
||||||
{"foo", "bar"}, //1. user:foo password:bar
|
"foo": "bar", // user:foo password:bar
|
||||||
{"manu", "123"}, //2. user:manu password:123
|
"manu": "123", // user:manu password:123
|
||||||
}))
|
}))
|
||||||
|
|
||||||
authorized.POST("admin", func(c *gin.Context) {
|
authorized.POST("admin", func(c *gin.Context) {
|
||||||
user := c.Get("user").(string)
|
user := c.Get(gin.AuthUserKey).(string)
|
||||||
|
|
||||||
// Parse JSON
|
// Parse JSON
|
||||||
var json struct {
|
var json struct {
|
||||||
|
|
Loading…
Reference in New Issue