Cant add cookie into header


#1

i copied this code

func writeCookies(c echo.Context) error {
cookie := new(http.Cookie)
cookie.Name = “username”
cookie.Value = “jon”
cookie.Expires = time.Now().Add(24 * time.Hour)
c.SetCookie(cookie)
return c.String(http.StatusOK, “write a cookie”)
}

then added in

e.POST("/post", writeCookies)

but i didnt see any cookie in response header

what did i wrong? How can fix it
sorry about my poor english


#2

Just tried your code (tested in postman) and I couldn’t replicate the issue. If you are still looking for an answer, let me know.