Skip to content

How to access Keys of gin.Context? #45

@zxyao145

Description

@zxyao145

Hi, I set the user infomation in a filter of gin, the filter is as follows:

func Authentication() gin.HandlerFunc {
    return func(c *gin.Context){
        userId := "123"
        c.Set("userId", userId)
        c.Next()
    }
}

How should I get the value of userId?

func (h *Handler) current(c droplet.Context) (interface{}, error){
    userId := ????
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions