open-standards/wai/http-conformance/falsify/index-member-added.patch

15 lines
930 B
Diff

# must fail: receipts_index_member_added
# an index with a member it does not define read (receipts::ReceiptIndex::from_bytes)
diff --git a/wai/wai-rs/src/http_binding/receipts.rs b/wai/wai-rs/src/http_binding/receipts.rs
index 95b77f2f..26bf86c7 100644
--- a/wai/wai-rs/src/http_binding/receipts.rs
+++ b/wai/wai-rs/src/http_binding/receipts.rs
@@ -189,7 +189,7 @@ impl ReceiptIndex {
let v = crate::claim_receipt::parse_strict(text).map_err(|_| bad("not JSON as a receipt is read"))?;
let m = v.as_object().ok_or(bad("not an object"))?;
const MEMBERS: [&str; 4] = ["kind", "object", "delivery", "claims"];
- if m.len() != MEMBERS.len() || MEMBERS.iter().any(|k| !m.contains_key(*k)) {
+ if MEMBERS.iter().any(|k| !m.contains_key(*k)) {
return Err(bad("the members are not kind, object, delivery and claims"));
}
if m["kind"].as_str() != Some(INDEX_KIND) {