From 7e77ffc652d537000dc17c4e79d63b7af61769d4 Mon Sep 17 00:00:00 2001 From: John Hooks Date: Sat, 16 Mar 2024 20:47:48 -0400 Subject: [PATCH] Header design Referring to this PR https://github.com/nats-io/nats.go/pull/1584 this includes an add() method to add a header key and value. This would facilitate extra context since the service doesn't have direct access to the request. --- adr/ADR-32.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/adr/ADR-32.md b/adr/ADR-32.md index a9fc4c10..fd9256d4 100644 --- a/adr/ADR-32.md +++ b/adr/ADR-32.md @@ -15,6 +15,7 @@ | 2 | 2023-09-12 | Configurable queue group | | 3 | 2023-10-07 | Add version regex info | | 4 | 2023-11-10 | Explicit naming | +| 5 | 2024-03-16 | Header methods | ## Context and Problem Statement @@ -352,3 +353,15 @@ will dispatch requests as fast as the handler returns. For consistency of documentation and understanding by users, clients that implement the service API and tooling that interacts with services should use the term "service" or "services". + + +### Headers + +Services should allow headers to be retrieved through two methods: + +- get(key) - returns the first value associated with the key +- values(key) - returns all values associated with the key + +Services should allow a header value to be added through the following method: + +- add(key, value) - adds the value to the associated key or adds the key/value if the key doesn't exist.