Fix nil panic in authentication middleware example (#489)
This commit is contained in:
committed by
Matt Silverlock
parent
212aa90d7c
commit
4248f5cd87
2
doc.go
2
doc.go
@@ -295,7 +295,7 @@ A more complex authentication middleware, which maps session token to users, cou
|
|||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
r.HandleFunc("/", handler)
|
r.HandleFunc("/", handler)
|
||||||
|
|
||||||
amw := authenticationMiddleware{}
|
amw := authenticationMiddleware{tokenUsers: make(map[string]string)}
|
||||||
amw.Populate()
|
amw.Populate()
|
||||||
|
|
||||||
r.Use(amw.Middleware)
|
r.Use(amw.Middleware)
|
||||||
|
|||||||
Reference in New Issue
Block a user