Open zetaab opened 1 year ago
actually I found pretty easy way:
cook := &http.Cookie{
Name: "bar",
Value: "foo",
Path: "/",
HttpOnly: true,
Secure: true,
Domain: host,
MaxAge: 3600 * 12,
}
resp.Headers().Add("Set-Cookie", cook.String())
Currently there is no easy way to add http.Cookie to response https://github.com/http-wasm/http-wasm-guest-tinygo/blob/main/handler/api/api.go#L135
of course it can be done through
w.Header().Add("Set-Cookie", "a=b")
. However, it would be nice to have helper function which does this out of the box (including parameters like Expires, Secure, HttpOnly). Example from go source https://cs.opensource.google/go/go/+/refs/tags/go1.21.3:src/net/http/cookie.go;l=169