Add tests for getSessionId helper

This commit is contained in:
Dan Sosedoff
2016-02-26 08:48:55 -08:00
parent 86f63eecc5
commit c57b477dc9
4 changed files with 21 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ var (
func DB(c *gin.Context) *client.Client {
if command.Opts.Sessions {
return DbSessions[getSessionId(c)]
return DbSessions[getSessionId(c.Request)]
} else {
return DbClient
}
@@ -39,7 +39,7 @@ func setClient(c *gin.Context, newClient *client.Client) error {
return nil
}
sessionId := getSessionId(c)
sessionId := getSessionId(c.Request)
if sessionId == "" {
return errors.New("Session ID is required")
}