pkg/http: Error on SetCookie if cookie handler is request aware.

Signed-off-by: Mark Laing <mark.laing@canonical.com>
This commit is contained in:
Mark Laing 2025-06-04 10:19:06 +01:00
parent eae9da5e4c
commit 05e528cff0
No known key found for this signature in database
GPG key ID: D9277AD9F18400E0

View file

@ -97,6 +97,10 @@ func (c *CookieHandler) CheckQueryCookie(r *http.Request, name string) (string,
}
func (c *CookieHandler) SetCookie(w http.ResponseWriter, name, value string) error {
if c.IsRequestAware() {
return errors.New("Cookie handler is request aware")
}
encoded, err := c.securecookie.Encode(name, value)
if err != nil {
return err