olahol/melody

Return Session from HandleRequest

Closed this issue · 1 comments

vdka commented

I am looking for some way to pass the Context I already have into a Session context. Currently I don't think there is any way to do this.

Is HandleRequest returning the Session it creates something that would be worthwhile?

authorized.GET("/ws", func(c *gin.Context) {
    session := m.HandleRequest(c.Writer, c.Request)

    session.Keys = c.Keys
})

Or possibly injecting Keys directly?

authorized.GET("/ws", func(c *gin.Context) {
    m.HandleRequestWithContext(c.Writer, c.Request, c.Keys)
})

Thank you for the idea, there is now a method melody.HandleRequestWithKeys where you can populated session.Keys.