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

Method from_headers_with

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

Negotiate content encoding from a caller-specified header name. Same as [`from_headers`](Self::from_headers) but reads from `needle` instead of `accept-encoding`. Useful for protocols that use a different header for encoding negotiation (e.g. `grpc-accept-encoding` for gRPC).

(headers: &HeaderMap, needle: &HeaderName)

Source from the content-addressed store, hash-verified

56 /// `accept-encoding`. Useful for protocols that use a different header for encoding
57 /// negotiation (e.g. `grpc-accept-encoding` for gRPC).
58 pub fn from_headers_with(headers: &HeaderMap, needle: &HeaderName) -> Self {
59 let mut prefer = ContentEncodingWithQValue::default();
60
61 for encoding in Self::_from_headers(headers, needle) {
62 prefer.try_update(encoding);
63 }
64
65 prefer.enc
66 }
67
68 /// Encode a response body, updating response headers accordingly.
69 ///

Callers

nothing calls this directly

Calls 1

try_updateMethod · 0.45

Tested by

no test coverage detected