Cookie identifies a HTTP cookie. When used within a Response the Cookie DSL also makes it possible to define the cookie attributes. Cookie must appear in the API HTTP or JSONRPC expression (to define request cookies common to all the API endpoints), a service HTTP or JSONRPC expression (to define r
(name string, args ...any)
| 455 | // }) |
| 456 | // }) |
| 457 | func Cookie(name string, args ...any) { |
| 458 | h := cookies(eval.Current()) |
| 459 | if h == nil { |
| 460 | eval.IncompatibleDSL() |
| 461 | return |
| 462 | } |
| 463 | if name == "" { |
| 464 | eval.ReportError("header name cannot be empty") |
| 465 | } |
| 466 | eval.Execute(func() { Attribute(name, args...) }, h.AttributeExpr) |
| 467 | h.Remap() |
| 468 | } |
| 469 | |
| 470 | // CookieMaxAge defines the "max-age" attribute of a HTTP response cookie. |
| 471 | // |