MCPcopy Create free account
hub / github.com/HFQR/xitca-web / _from_headers

Method _from_headers

http-encoding/src/coding.rs:170–186  ·  view source on GitHub ↗
(headers: &HeaderMap, needle: &HeaderName)

Source from the content-addressed store, hash-verified

168 }
169
170 fn _from_headers(headers: &HeaderMap, needle: &HeaderName) -> impl Iterator<Item = ContentEncodingWithQValue> {
171 headers
172 .get_all(needle)
173 .iter()
174 .filter_map(|hval| hval.to_str().ok())
175 .flat_map(|s| s.split(','))
176 .filter_map(|v| {
177 let mut v = v.splitn(2, ';');
178 Self::try_parse(v.next().unwrap().trim()).ok().map(|enc| {
179 let val = v
180 .next()
181 .and_then(|v| QValue::parse(v.trim()))
182 .unwrap_or_else(QValue::one);
183 ContentEncodingWithQValue { enc, val }
184 })
185 })
186 }
187
188 pub(super) fn try_parse(s: &str) -> Result<Self, FeatureError> {
189 if s.eq_ignore_ascii_case("gzip") {

Callers

nothing calls this directly

Calls 5

and_thenMethod · 0.80
iterMethod · 0.45
splitMethod · 0.45
mapMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected