pub fn insert_header<H>(&mut self, header: H) -> &mut Self
    where
        H: IntoHeaderPair,
    {
        if let Some(parts) = self.inner() {
            match header.try_into_header_pair() {
                Ok((key, value)) => {
                    parts.headers.insert(key, value);
                }
                Err(e) => self.err = Some(e.into()),
            };
        }

        self
    }
/// Insert a header, replacing any that were set with an equivalent field name.
///
/// # Examples
/// ```
/// use actix_http::{ResponseBuilder, http::header};
///
/// let res = ResponseBuilder::default()
///     .insert_header((header::CONTENT_TYPE, mime::APPLICATION_JSON))
///     .insert_header(("X-TEST", "value"))
///     .finish();
///
/// assert!(res.headers().contains_key("content-type"));
/// assert!(res.headers().contains_key("x-test"));
/// ```
Insert a header, replacing any that were set with an equivalent field name.
Insert a header replacing any that were set with an equivalent field name .
pub fn insert_header<H>(&mut self, header: H) -> &mut Self
    where
        H: IntoHeaderPair,
    {
        if let Some(parts) = self.inner() {
            match header.try_into_header_pair() {
                Ok((key, value)) => {
                    parts.headers.insert(key, value);
                }
                Err(e) => self.err = Some(e.into()),
            };
        }
        self
    }
pub fn insert_header < H > ( & mut self , header : H ) -> & mut Self where H : IntoHeaderPair , { if let Some ( parts ) = self . inner ( ) { match header . try_into_header_pair ( ) { Ok ( ( key , value ) ) => { parts . headers . insert ( key , value ) ; } Err ( e ) => self . err = Some ( e . into ( ) ) , } ; } self }
Insert a header, replacing any that were set with an equivalent field name.
Insert a header replacing any that were set with an equivalent field name .
&mut self
header
H
&mut self
header
H
examples
```
use actix_http::{ResponseBuilder, http::header}.

let res = ResponseBuilder::default()
.insert_header((header::CONTENT_TYPE, mime::APPLICATION_JSON))
.insert_header(("X-TEST", "value"))
.finish().

assert!(res.headers().contains_key("content-type"));
assert!(res.headers().contains_key("x-test"));
```
` ` ` use actix_http :: { ResponseBuilder http :: header } . let res = ResponseBuilder :: default () . insert_header (( header :: CONTENT_TYPE mime :: APPLICATION_JSON )) . insert_header (( " X - TEST " " value " )) . finish () . assert! ( res . headers () . contains_key ( " content - type " )) ; assert! ( res . headers () . contains_key ( " x - test " )) ; ` ` `