open-standards/wai/http-conformance/falsify/established-on-refusal.patch

15 lines
1 KiB
Diff

# must fail: receipts_fetch_refused_holds_nothing
# a fetch that was refused establishing its cid (session::FetchSession::established)
diff --git a/wai/wai-rs/src/http_binding/session.rs b/wai/wai-rs/src/http_binding/session.rs
index 2381b3fb..549fe94c 100644
--- a/wai/wai-rs/src/http_binding/session.rs
+++ b/wai/wai-rs/src/http_binding/session.rs
@@ -383,7 +383,7 @@ impl FetchSession {
/// for a layer whose request was abandoned, of which nothing was received. Only a
/// session builds the second kind, so a cid nothing verified never stands in for one.
pub fn established(&self) -> Option<crate::jwp_hash::EstablishedHash> {
- let f = self.done()?;
+ let Some(f) = self.done() else { return Some(crate::jwp_hash::EstablishedHash::by_head_proof(self.cid)) };
match f.verified_by {
VerifiedBy::WholeObject => f.envelope.as_deref().map(crate::jwp_hash::EstablishedHash::of_envelope),
VerifiedBy::HeadProof => Some(crate::jwp_hash::EstablishedHash::by_head_proof(self.cid)),