pub fn request_header(&mut self, format: &str) -> String {
        let mut string = String::new();

        let mut found = 0;
        let mut last_end = 0;
        for mat in Regex::new(r"\{\{(.*?)\}\}").unwrap().find_iter(format) {
            let json_val = Value::String(String::from(mat.as_str()));
            let value: Value = from_str(&self.request_value(&json_val)).unwrap();

            string.push_str(format.get(last_end..mat.start()).unwrap());

            string.push_str(value.as_str().unwrap());

            last_end = mat.end();

            found += 1;
        }

        string.push_str(format.get(last_end..format.len()).unwrap());
        if found == 0 {
            String::from(format)
        } else {
            string
        }
    }
/// Parsing a pattern in a request header
Parsing a pattern in a request header
Parsing a pattern in a request header
pub fn request_header(&mut self, format: &str) -> String {
        let mut string = String::new();
        let mut found = 0;
        let mut last_end = 0;
        for mat in Regex::new(r"\{\{(.*?)\}\}").unwrap().find_iter(format) {
            let json_val = Value::String(String::from(mat.as_str()));
            let value: Value = from_str(&self.request_value(&json_val)).unwrap();
            string.push_str(format.get(last_end..mat.start()).unwrap());
            string.push_str(value.as_str().unwrap());
            last_end = mat.end();
            found += 1;
        }
        string.push_str(format.get(last_end..format.len()).unwrap());
        if found == 0 {
            String::from(format)
        } else {
            string
        }
    }
pub fn request_header ( & mut self , format : & str ) -> String { let mut string = String :: new ( ) ; let mut found = 0 ; let mut last_end = 0 ; for mat in Regex :: new ( r"\{\{(.*?)\}\}" ) . unwrap ( ) . find_iter ( format ) { let json_val = Value :: String ( String :: from ( mat . as_str ( ) ) ) ; let value : Value = from_str ( & self . request_value ( & json_val ) ) . unwrap ( ) ; string . push_str ( format . get ( last_end .. mat . start ( ) ) . unwrap ( ) ) ; string . push_str ( value . as_str ( ) . unwrap ( ) ) ; last_end = mat . end ( ) ; found += 1 ; } string . push_str ( format . get ( last_end .. format . len ( ) ) . unwrap ( ) ) ; if found == 0 { String :: from ( format ) } else { string } }
Parsing a pattern in a request header
Parsing a pattern in a request header
&mut self
format
&str