Fixes BasicAuth test in example_basic.go

This commit is contained in:
Manu Mtz-Almeida 2014-07-04 04:40:00 +02:00
parent fa80b047f9
commit 9efd207a04
1 changed files with 3 additions and 3 deletions

View File

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