pub fn bearer_auth(mut self, token: &str) -> Self {
        const TYPE: &'static str = "Bearer ";

        let header_value = unsafe {
            let mut header_value = bytes::BytesMut::with_capacity(token.as_bytes().len() + TYPE.as_bytes().len());
            header_value.put_slice(TYPE.as_bytes());
            header_value.put_slice(token.as_bytes());
            http::header::HeaderValue::from_maybe_shared_unchecked(header_value.freeze())
        };

        let _ = self.headers().insert(http::header::AUTHORIZATION, header_value);

        self
    }
///Adds bearer authentication header.
///
///Generally tokens already contain only valid symbols for header.
///So the function doesn't encode it using base64.
Adds bearer authentication header.
Generally tokens already contain only valid symbols for header.
So the function doesn't encode it using base64.
Adds bearer authentication header . Generally tokens already contain only valid symbols for header . So the function doesn ' t encode it using base64 .
pub fn bearer_auth(mut self, token: &str) -> Self {
        const TYPE: &'static str = "Bearer ";
        let header_value = unsafe {
            let mut header_value = bytes::BytesMut::with_capacity(token.as_bytes().len() + TYPE.as_bytes().len());
            header_value.put_slice(TYPE.as_bytes());
            header_value.put_slice(token.as_bytes());
            http::header::HeaderValue::from_maybe_shared_unchecked(header_value.freeze())
        };
        let _ = self.headers().insert(http::header::AUTHORIZATION, header_value);
        self
    }
pub fn bearer_auth ( mut self , token : & str ) -> Self { const TYPE : & ' static str = " " ; let header_value = unsafe { let mut header_value = bytes :: BytesMut :: with_capacity ( token . as_bytes ( ) . len ( ) + TYPE . as_bytes ( ) . len ( ) ) ; header_value . put_slice ( TYPE . as_bytes ( ) ) ; header_value . put_slice ( token . as_bytes ( ) ) ; http :: header :: HeaderValue :: from_maybe_shared_unchecked ( header_value . freeze ( ) ) } ; let _ = self . headers ( ) . insert ( http :: header :: AUTHORIZATION , header_value ) ; self }
Adds bearer authentication header.
Adds bearer authentication header .
mut self
token
&str