http-rs / http-rs/http-types

Accept header sort is not stable leading to unstable negotiation result

Open
#361 1 comment 0 reactions 0 assignees View on GitHub
bug good first issue
Dominant language
Rust
Stars
209
Forks
91
PR merge metrics
No merged PRs in 30d

Description

The following test passes:

```rust
#[test]
fn negotiate_tie() -> crate::Result<()> {
let mut accept = Accept::new();
accept.push(MediaTypeProposal::new(mime::HTML, Some(0.4))?);
accept.push(MediaTypeProposal::new(mime::XML, Some(0.4))?);

assert_eq!(accept.negotiate(&[mime::HTML, mime::XML])?, mime::XML);
assert_eq!(accept.negotiate(&[mime::XML, mime::HTML])?, mime::HTML);
Ok(())
}
```

`XML` (or `HTML`?) should be picked the two times.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.