diff --git a/libs/sdk-common/src/input_parser.rs b/libs/sdk-common/src/input_parser.rs index da11adce7..2008544a9 100644 --- a/libs/sdk-common/src/input_parser.rs +++ b/libs/sdk-common/src/input_parser.rs @@ -166,7 +166,7 @@ const LNURL_PAY_PREFIX: &str = "lnurl="; /// } /// ``` /// -/// ### External input parsing +/// ## External input parsing /// /// ```no_run /// use sdk_common::prelude::{InputType::*, parse, ExternalInputParser}; @@ -176,7 +176,7 @@ const LNURL_PAY_PREFIX: &str = "lnurl="; /// let external_parser = ExternalInputParser { /// provider_id: "provider_id".to_string(), /// input_regex: "(.*)(provider.domain)(.*)".to_string(), -/// parser_url: "http://external-parser-domain.com/{{input}}".to_string(), +/// parser_url: "http://external-parser-domain.com/".to_string(), /// }; /// /// let data = "151931provider.domain069135"; @@ -353,7 +353,7 @@ async fn parse_external( // Build URL let urlsafe_input = percent_encoding::utf8_percent_encode(input, NON_ALPHANUMERIC).to_string(); - let parser_url = parser.parser_url.replacen("{{input}}", &urlsafe_input, 1); + let parser_url = parser.parser_url.replacen("", &urlsafe_input, 1); // Make request let parsed_value = match request_external_parsing(&parser_url).await { @@ -835,7 +835,7 @@ pub struct ExternalInputParser { pub provider_id: String, /// The external parser will be used when an input conforms to this regex pub input_regex: String, - /// The URL of the parser containing a placeholder `{{input}}` that will be replaced with the + /// The URL of the parser containing a placeholder `` that will be replaced with the /// input to be parsed. The input is sanitized using percent encoding. pub parser_url: String, } @@ -1964,7 +1964,7 @@ pub(crate) mod tests { let parsers = vec![ExternalInputParser { provider_id: "id".to_string(), input_regex: "(.*)(provider.domain)(.*)".to_string(), - parser_url: "http://127.0.0.1:8080/{{input}}".to_string(), + parser_url: "http://127.0.0.1:8080/".to_string(), }]; let input_type = parse(input, Some(&parsers)).await?; @@ -2017,12 +2017,12 @@ pub(crate) mod tests { ExternalInputParser { provider_id: "bitcoin".to_string(), input_regex: "(.*)(bitcoin.address.provider)(.*)".to_string(), - parser_url: "http://127.0.0.1:8080/{{input}}".to_string(), + parser_url: "http://127.0.0.1:8080/".to_string(), }, ExternalInputParser { provider_id: "bolt11".to_string(), input_regex: "(.*)(bolt11.provider)(.*)".to_string(), - parser_url: "http://127.0.0.1:8080/{{input}}".to_string(), + parser_url: "http://127.0.0.1:8080/".to_string(), }, ]; @@ -2057,7 +2057,7 @@ pub(crate) mod tests { let parsers = vec![ExternalInputParser { provider_id: "id".to_string(), input_regex: "(.*)(provider.domain)(.*)".to_string(), - parser_url: "http://127.0.0.1:8080/{{input}}".to_string(), + parser_url: "http://127.0.0.1:8080/".to_string(), }]; let result = parse(input, Some(&parsers)).await;