D
D
Denis Dolmatov2018-11-11 14:29:48
go
Denis Dolmatov, 2018-11-11 14:29:48

How to handle cookies in Golang Gorilla?

Hello got user cookie when registering now cookie.Values[id]=id. Now this user wants to write an article. I need to take his username from the cookie in order to assign the article to him. But when receiving cookies, they come in the form of an interface, although when determining the type it shows that it is a string type. How do I get the id from the cookie as a string and not as an interface, or how do I handle the interface, or should there be another approach? Post examples if possible.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Dolmatov, 2018-11-11
@Dolmat

Helped me: session.Values["id"].(string) type assertions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question