# must fail: union_O9 # the union is the floor, the intersection (codecs::union_of) diff --git a/wai/wai-rs/src/http_binding/codecs.rs b/wai/wai-rs/src/http_binding/codecs.rs index 530ae822..97e32ca4 100644 --- a/wai/wai-rs/src/http_binding/codecs.rs +++ b/wai/wai-rs/src/http_binding/codecs.rs @@ -338,8 +338,9 @@ pub fn union_of(objects: &[SeqObject]) -> Result { let each = described(objects)?; let prefix = objects.iter().map(|o| if o.head.version == Version::Wai2 { Prefix::Wai2 } else { Prefix::Wai1 }).max().unwrap_or(Prefix::Wai1); let mut alts: Vec = Vec::new(); + let all = each.clone(); for e in each { - for a in e.alts { + for a in e.alts.into_iter().filter(|a| all.iter().all(|o| o.alts.iter().any(|x| x.cap == a.cap))) { match alts.iter_mut().find(|x| x.cap == a.cap) { Some(x) => { for p in a.plus {