feat(registry,daemon): ETag downloads; report pending changes
This commit is contained in:
1 parent
fdfab9277b
commit
85ff7a8c75
8 files changed
+65
-3
No files matched your search
+16
-2
@@ -871,8 +871,22 @@ VOID_TEST(RegistryTests, registry_binary_variant_publish_download_and_materializ
|
||||
if (downloaded) {
|
||||
Void::Testing::expect(downloaded->body == artifact);
|
||||
}
|
||||
auto ranged =
|
||||
send_loopback_http(port, "GET", binary_path + "/download", {{"Range", "bytes=0-3"}});
|
||||
auto etag_head = send_loopback_http(port, "GET", binary_path + "/download");
|
||||
Void::Testing::expect(etag_head.has_value() && etag_head->status == 200);
|
||||
if (etag_head) {
|
||||
const auto etag_it = etag_head->headers.find("etag");
|
||||
Void::Testing::expect(etag_it != etag_head->headers.end());
|
||||
if (etag_it != etag_head->headers.end()) {
|
||||
auto cached = send_loopback_http(port, "GET", binary_path + "/download",
|
||||
{{"If-None-Match", etag_it->second}});
|
||||
Void::Testing::expect(cached.has_value() && cached->status == 304);
|
||||
if (cached) {
|
||||
Void::Testing::expect(cached->body.empty());
|
||||
}
|
||||
}
|
||||
}
|
||||
auto ranged = send_loopback_http(port, "GET", binary_path + "/download",
|
||||
{{"Range", "bytes=0-3"}});
|
||||
Void::Testing::expect(ranged.has_value() && ranged->status == 206);
|
||||
if (ranged) {
|
||||
Void::Testing::expect_eq(ranged->body, artifact.substr(0, 4));
|
||||
|
||||
Reference in new issue
Block a user