accept-header's People
Forkers
wallaroolabsaccept-header's Issues
Publish on crates.io
I don't want to use a different crate registry other than crates.io and using a git dependency is out of my scope too. Unfortunately, the name has been taken by a different crate, which does not implement the Header
trait. Perhaps you could publish it under a different name?
Don't depend on `mime` crate
Ordering bug
There appears to be a bug in the implementation. For example, consider this test case:
diff --git a/src/lib.rs b/src/lib.rs
index 22cfc31..074c2be 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -243,4 +243,22 @@ mod tests {
let expect = &[("application/json", 1.0, None)];
perform_test(input, expect);
}
+
+ #[test]
+ fn ordering_bug() {
+ let input = "Accept: image/webp,image/avif,image/jxl,image/heic,image/heic-sequence,video/*;q=0.8,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5";
+ let expect = &[
+ ("image/webp", 1.0, None),
+ ("image/avif", 1.0, None),
+ ("image/jxl", 1.0, None),
+ ("image/heic", 1.0, None),
+ ("image/heic-sequence", 1.0, None),
+ ("image/png", 1.0, None),
+ ("image/svg+xml", 1.0, None),
+ ("video/*", 0.8, None),
+ ("image/*", 0.8, None),
+ ("*/*", 0.5, None),
+ ];
+ perform_test(input, expect);
+ }
}
Where implied quality should be 1.0
it's rendering as None
and for some reason avif
is ordered before webp
. This seems like an incorrect parsing of the example Accept
value (taken from Safari).
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.