fix(api): never cache anchor=latest windows as immutable [CI]
ci/woodpecker/push/web-build Pipeline was successful
ci/woodpecker/push/verify Pipeline was successful
ci/woodpecker/push/dev-image Pipeline was successful

This commit is contained in:
justme committed 2026-10-19 11:29:34 +08:00
1 parent fb9dc155f5
commit b33e50696d
2 files changed
+8 -1

No files matched your search

@@ -96,6 +96,10 @@ public sealed class IngestAndQueryTests : IClassFixture<BackendFixture>
Assert.Equal(600, anchored["summary"]!["samples"]!["udp_echo"]!.GetValue<long>());
Assert.False(anchored["live"]!.GetValue<bool>());
// 这个窗口是以“最后一个样本”为终点的绝对区间,但线路恢复之后同一个地址的内容就变了:不能被浏览器永久缓存
using HttpResponseMessage raw = await _backend.Admin.GetAsync($"/api/public/lines/{_backend.Line(id)}/series?range=5m&step=10s&metrics=loss.total&anchor=latest");
Assert.Equal("no-store", raw.Headers.CacheControl!.ToString());
// anchor=now is the default behaviour; anything else is rejected
JsonNode explicitNow = await SeriesAsync(id, "range=5m&step=10s&metrics=loss.total&anchor=now");
Assert.Null(explicitNow["summary"]!["samples"]!["udp_echo"]);