api: optimize status endpoint payload and caching

This commit is contained in:
2026-06-07 19:04:30 -06:00
parent a721f6b539
commit 512a1aa302
3 changed files with 166 additions and 1 deletions
+18
View File
@@ -282,3 +282,21 @@ def test_http_error_fixture_and_known_error_codes_are_stable():
"invalid_relay_action",
]:
assert error_code in source
def test_status_endpoint_supports_field_selection_and_cache_headers():
source = firmware_source()
assert 'server.hasArg("fields")' in source
assert 'server.arg("fields")' in source
assert 'findStatusFieldIndex' in source
assert '"invalid_field"' in source
assert 'Unknown field' in source
assert 'server.send(400, "application/json", errorOutput)' in source
assert 'server.sendHeader("ETag", etag)' in source
assert 'server.sendHeader("Last-Modified", lastStatusModified)' in source
assert 'server.sendHeader("Cache-Control", "no-cache")' in source
assert 'server.header("If-None-Match")' in source
assert 'server.header("If-Modified-Since")' in source
assert 'server.send(304)' in source
assert 'server.collectHeaders(statusCacheHeaders, 2)' in source