HeaderMapExt should provide a `typed_{try_}get` alternative that handles missing headers
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust
- Domain
- networking
Research direction
Start with HeaderMapExt::typed_{try_}get and the Header::decode behavior described in the issue and linked discussion. Define the missing-header variants so they forward an empty iterator to the specific header implementation; done means each method returns Result<H, Error> and permits that implementation to provide a fallback or error.
Written by the indexing model from the issue text.
Description
See the discussion in https://github.com/tokio-rs/axum/issues/1781#issuecomment-1442496072 for the original issue & motivation.
TL;DR is that Header::decode allows each typed header to handle empty iterators in its own way and let the header implementation decide whether missing header is an error or whether to provide some default "parsed" value (e.g. empty collection), but HeaderMapExt::typed_{try_}get always return Option::None when header is not found in the HeaderMap, not giving such Header implementation a chance to correctly provide their own fallback.
It would be useful to have variation of those methods that always return Result<H, Error> by forwarding an empty iterator to the specific H::decode implementation and letting it decide whether to provide a Ok(fallback_value) or emit an error.
- Dominant language
- Rust
- Stars
- 200
- Forks
- 107
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hyperium/headers
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Link support Open
Difficulty 4/5 3-5 days Newbie friendliness 38/100
All issues in hyperium/headers
Similar issues
-
Browser (wasm) relay client cannot connect to relays whose URL has a trailing-dot FQDN hostname Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
n0-computer/iroh#4550 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
paritytech/zombienet-sdk#591 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
farion1231/cc-switch#7638 · 1 comment ·
-
onnx-ir re-exports ModelProto and GraphProto but not NodeProto, AttributeProto and AttributeType Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100