- commit
- 947c63f71b306c40ea6ba328401dd88d36985fff
- parent
- 5d4551e662ca97c519d3e3cbdb8c2cae766b26be
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2025-06-05 08:02
return X-Via-History-Remaining on POST requests fixes #1
Diffstat
| M | README.md | 5 | +++-- |
| M | via.go | 3 | +++ |
2 files changed, 6 insertions, 2 deletions
diff --git a/README.md b/README.md
@@ -29,8 +29,9 @@ Use the `hmsg` prefix if you want to keep a history: 29 29 # DELETE deletes the history 30 30 curl http://localhost:8001/hmsg/someid -X DELETE 31 3132 -1 # the history only keeps up to 100 entries.33 -1 # you can optimize it by replacing all entries by a single message-1 32 # the history only keeps up to 100 entries -1 33 # you can consolidate it by replacing all entries by a single message -1 34 # the `X-Via-History-Remaining` header on POST tells you how much space is left 34 35 curl http://localhost:8001/hmsg/someid -d combined -H 'Last-Event-Id: 3' -X PUT 35 36 36 37 You can also protect your ID with a password so no one else can listen to
diff --git a/via.go b/via.go
@@ -236,6 +236,9 @@ func post(w http.ResponseWriter, r *http.Request) {
236 236
237 237 if topic.hasHistory {
238 238 topic.storeHistory(key)
-1 239
-1 240 remain := maxHistorySize - len(topic.history)
-1 241 w.Header().Set("X-Via-History-Remaining", fmt.Sprintf("%d", remain))
239 242 }
240 243 }
241 244