Rename sessionID to sid
This commit is contained in:
parent
f33a44bb1f
commit
0896799a25
|
@ -13,10 +13,10 @@ import (
|
||||||
|
|
||||||
type (
|
type (
|
||||||
request struct {
|
request struct {
|
||||||
r *http.Request
|
r *http.Request
|
||||||
w http.ResponseWriter
|
w http.ResponseWriter
|
||||||
sessionID string
|
sid string
|
||||||
login string
|
login string
|
||||||
}
|
}
|
||||||
statRequest struct {
|
statRequest struct {
|
||||||
org string
|
org string
|
||||||
|
@ -31,16 +31,16 @@ func parseRequest(w http.ResponseWriter, r *http.Request) (*request, *statReques
|
||||||
sid := sessionID(w, r)
|
sid := sessionID(w, r)
|
||||||
login, _ := redis.String(redisPool.Get().Do("HGET", "sessions", sid))
|
login, _ := redis.String(redisPool.Get().Do("HGET", "sessions", sid))
|
||||||
req := &request{
|
req := &request{
|
||||||
r: r,
|
r: r,
|
||||||
w: w,
|
w: w,
|
||||||
sessionID: sid,
|
sid: sid,
|
||||||
login: login,
|
login: login,
|
||||||
}
|
}
|
||||||
return req, parseStatRequest(r)
|
return req, parseStatRequest(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *request) authorize(login string) {
|
func (r *request) authorize(login string) {
|
||||||
redisPool.Get().Do("HSET", "sessions", r.sessionID, login)
|
redisPool.Get().Do("HSET", "sessions", r.sid, login)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *request) respondWith(resp interface{}) {
|
func (r *request) respondWith(resp interface{}) {
|
||||||
|
|
Loading…
Reference in New Issue