headers icon indicating copy to clipboard operation
headers copied to clipboard

`IfNoneMatch::decode()` returns and empty `ETag` even if the iterator passed to it is empty

Open devashishdxt opened this issue 11 months ago • 0 comments

use headers::{IfNoneMatch, Header};

#[test]
fn test_empty_if_none_match() {
    let mut iter = std::iter::empty();
    let if_none_match = IfNoneMatch::decode(&mut iter);

    assert!(if_none_match.is_err()); // This assert fails. `decode` returns `Ok(IfNoneMatch(Tags("")))`
}

This means that even if there's no IfNoneMatch header in the request, this'll still report it as present.

devashishdxt avatar Jan 22 '25 06:01 devashishdxt