pub fn header<K, V>(mut self, key: K, value: V) -> Self
    where
        HeaderName: TryFrom<K>,
        HeaderValue: TryFrom<V>,
    {
        let name: HeaderName = TryFrom::try_from(key)
            .map_err(|_| ())
            .expect("invalid header name");
        let value = TryFrom::try_from(value)
            .map_err(|_| ())
            .expect("invalid header value");
        self.req.headers_mut().insert(name, value);
        self
    }
/// Set a header for this request.
///
/// # Example
///
/// ```
/// let req = warp::test::request()
///     .header("accept", "application/json");
/// ```
///
/// # Panic
///
/// This panics if the passed strings are not able to be parsed as a valid
/// `HeaderName` and `HeaderValue`.
Set a header for this request.
Set a header for this request .
pub fn header<K, V>(mut self, key: K, value: V) -> Self
    where
        HeaderName: TryFrom<K>,
        HeaderValue: TryFrom<V>,
    {
        let name: HeaderName = TryFrom::try_from(key)
            .map_err(|_| ())
            .expect("invalid header name");
        let value = TryFrom::try_from(value)
            .map_err(|_| ())
            .expect("invalid header value");
        self.req.headers_mut().insert(name, value);
        self
    }
pub fn header < K , V > ( mut self , key : K , value : V ) -> Self where HeaderName : TryFrom < K > , HeaderValue : TryFrom < V > , { let name : HeaderName = TryFrom :: try_from ( key ) . map_err ( | _ | ( ) ) . expect ( " " ) ; let value = TryFrom :: try_from ( value ) . map_err ( | _ | ( ) ) . expect ( " " ) ; self . req . headers_mut ( ) . insert ( name , value ) ; self }
Set a header for this request.
Set a header for this request .
mut self
key
K
value
V
example
```
let req = warp::test::request()
.header("accept", "application/json");
```
` ` ` let req = warp :: test :: request () . header ( " accept " " application / json " ) ; ` ` `
panic
This panics if the passed strings are not able to be parsed as a valid
`HeaderName` and `HeaderValue`.
This panics if the passed strings are not able to be parsed as a valid ` HeaderName ` and ` HeaderValue ` .