feat(registry,daemon): answer HEAD without a body; mark editor generations stale
This commit is contained in:
1 parent
2c4eeba945
commit
3fa7ab086f
8 files changed
+190
-2
No files matched your search
@@ -272,6 +272,17 @@ VOID_TEST(RegistryTests, registry_rbac_immutability_csrf_xss_web_and_backup_rest
|
||||
auto anon_dl = send_loopback_http(port, "GET", "/api/v1/packages/secret-pkg/1.0.0/download");
|
||||
Void::Testing::expect(anon_dl.has_value() && anon_dl->status == 401);
|
||||
|
||||
// HEAD returns the GET headers (including Content-Length) without a body.
|
||||
auto head_dl = send_loopback_http(port, "HEAD", "/api/v1/packages/secret-pkg/1.0.0/download",
|
||||
{{"Authorization", "Bearer " + *alice_tok}});
|
||||
Void::Testing::expect(head_dl.has_value() && head_dl->status == 200);
|
||||
if (head_dl) {
|
||||
Void::Testing::expect(head_dl->body.empty());
|
||||
Void::Testing::expect(head_dl->headers.contains("content-length"));
|
||||
Void::Testing::expect(head_dl->headers.at("content-length") != "0");
|
||||
Void::Testing::expect(head_dl->headers.contains("x-content-sha256"));
|
||||
}
|
||||
|
||||
// Idempotent same-bytes republish -> 200 OK!
|
||||
auto idemp = send_loopback_http(
|
||||
port, "PUT", "/api/v1/packages/secret-pkg/1.0.0",
|
||||
@@ -846,6 +857,13 @@ VOID_TEST(RegistryTests, registry_binary_variant_publish_download_and_materializ
|
||||
if (downloaded) {
|
||||
Void::Testing::expect(downloaded->body == artifact);
|
||||
}
|
||||
auto head_binary = send_loopback_http(port, "HEAD", binary_path + "/download");
|
||||
Void::Testing::expect(head_binary.has_value() && head_binary->status == 200);
|
||||
if (head_binary) {
|
||||
Void::Testing::expect(head_binary->body.empty());
|
||||
Void::Testing::expect_eq(head_binary->headers.at("content-length"),
|
||||
std::to_string(artifact.size()));
|
||||
}
|
||||
|
||||
auto conflict = send_loopback_http(
|
||||
port, "PUT", binary_path,
|
||||
|
||||
Reference in new issue
Block a user