1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
use header::{Encoding, QualityItem}; header! { /// `TE` header, defined in /// [RFC7230](http://tools.ietf.org/html/rfc7230#section-4.3) /// /// As RFC7230 states, "The "TE" header field in a request indicates what transfer codings, /// besides chunked, the client is willing to accept in response, and /// whether or not the client is willing to accept trailer fields in a /// chunked transfer coding." /// /// For HTTP/1.1 compliant clients `chunked` transfer codings are assumed to be acceptable and /// so should never appear in this header. /// /// # ABNF /// /// ```text /// TE = "TE" ":" #( t-codings ) /// t-codings = "trailers" | ( transfer-extension [ accept-params ] ) /// ``` /// /// # Example values /// * `trailers` /// * `trailers, deflate;q=0.5` /// * `` /// /// # Examples /// /// ``` /// use hyper::header::{Headers, Te, Encoding, qitem}; /// /// let mut headers = Headers::new(); /// headers.set( /// Te(vec![qitem(Encoding::Trailers)]) /// ); /// ``` /// /// ``` /// use hyper::header::{Headers, Te, Encoding, qitem}; /// /// let mut headers = Headers::new(); /// headers.set( /// Te(vec![ /// qitem(Encoding::Trailers), /// qitem(Encoding::Gzip), /// qitem(Encoding::Deflate), /// ]) /// ); /// ``` /// /// ``` /// use hyper::header::{Headers, Te, Encoding, QualityItem, q, qitem}; /// /// let mut headers = Headers::new(); /// headers.set( /// Te(vec![ /// qitem(Encoding::Trailers), /// QualityItem::new(Encoding::Gzip, q(600)), /// QualityItem::new(Encoding::EncodingExt("*".to_owned()), q(0)), /// ]) /// ); /// ``` (Te, "TE") => (QualityItem<Encoding>)* test_te { // From the RFC test_header!(test1, vec![b"trailers"]); test_header!(test2, vec![b"trailers, deflate;q=0.5"]); test_header!(test3, vec![b""]); } }