feat(registry,daemon): honour If-None-Match; allow offline deps resolution
This commit is contained in:
1 parent
c6436a8010
commit
fdfab9277b
8 files changed
+140
-19
No files matched your search
+21
-6
@@ -824,6 +824,20 @@ VOID_TEST(RegistryTests, registry_binary_variant_publish_download_and_materializ
|
||||
}
|
||||
auto missing_release = send_loopback_http(port, "GET", "/api/v1/packages/demo-bin/9.9.9");
|
||||
Void::Testing::expect(missing_release.has_value() && missing_release->status == 404);
|
||||
|
||||
// Conditional requests: the ETag of a read response enables a bodyless 304.
|
||||
if (release_detail) {
|
||||
const auto etag_it = release_detail->headers.find("etag");
|
||||
Void::Testing::expect(etag_it != release_detail->headers.end());
|
||||
if (etag_it != release_detail->headers.end()) {
|
||||
auto not_modified = send_loopback_http(port, "GET", "/api/v1/packages/demo-bin/1.0.0",
|
||||
{{"If-None-Match", etag_it->second}});
|
||||
Void::Testing::expect(not_modified.has_value() && not_modified->status == 304);
|
||||
if (not_modified) {
|
||||
Void::Testing::expect(not_modified->body.empty());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (missing_release) {
|
||||
Void::Testing::expect(missing_release->body.find("release not found") != std::string::npos);
|
||||
}
|
||||
@@ -857,16 +871,17 @@ 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 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));
|
||||
Void::Testing::expect(ranged->headers.at("content-range").find("/" +
|
||||
std::to_string(artifact.size())) != std::string::npos);
|
||||
Void::Testing::expect(
|
||||
ranged->headers.at("content-range").find("/" + std::to_string(artifact.size())) !=
|
||||
std::string::npos);
|
||||
}
|
||||
auto unsatisfiable = send_loopback_http(port, "GET", binary_path + "/download",
|
||||
{{"Range", "bytes=999999-"}});
|
||||
auto unsatisfiable =
|
||||
send_loopback_http(port, "GET", binary_path + "/download", {{"Range", "bytes=999999-"}});
|
||||
Void::Testing::expect(unsatisfiable.has_value() && unsatisfiable->status == 416);
|
||||
auto head_binary = send_loopback_http(port, "HEAD", binary_path + "/download");
|
||||
Void::Testing::expect(head_binary.has_value() && head_binary->status == 200);
|
||||
|
||||
Reference in new issue
Block a user