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

Method from_headers

http-encoding/src/coding.rs:43–51  ·  view source on GitHub ↗

Negotiate content encoding from the `accept-encoding` header. Returns the highest q-value encoding that is supported by enabled crate features. Returns [`ContentEncoding::NoOp`] if no supported encoding is found.

(headers: &HeaderMap)

Source from the content-addressed store, hash-verified

41 /// Returns the highest q-value encoding that is supported by enabled crate features.
42 /// Returns [`ContentEncoding::NoOp`] if no supported encoding is found.
43 pub fn from_headers(headers: &HeaderMap) -> Self {
44 let mut prefer = ContentEncodingWithQValue::default();
45
46 for encoding in Self::_from_headers(headers, &ACCEPT_ENCODING) {
47 prefer.try_update(encoding);
48 }
49
50 prefer.enc
51 }
52
53 /// Negotiate content encoding from a caller-specified header name.
54 ///

Callers

nothing calls this directly

Calls 1

try_updateMethod · 0.45

Tested by

no test coverage detected