Header describes a single HTTP header or gRPC metadata header. The properties (description, type, validation etc.) of a header are inherited from the request or response type attribute with the same name by default. Header must appear in the API HTTP or JSONRPC expression (to define request headers
(name string, args ...any)
| 397 | // }) |
| 398 | // }) |
| 399 | func Header(name string, args ...any) { |
| 400 | h := headers(eval.Current()) |
| 401 | if h == nil { |
| 402 | eval.IncompatibleDSL() |
| 403 | return |
| 404 | } |
| 405 | if name == "" { |
| 406 | eval.ReportError("header name cannot be empty") |
| 407 | } |
| 408 | eval.Execute(func() { Attribute(name, args...) }, h.AttributeExpr) |
| 409 | h.Remap() |
| 410 | } |
| 411 | |
| 412 | // Cookie identifies a HTTP cookie. When used within a Response the Cookie DSL |
| 413 | // also makes it possible to define the cookie attributes. |