Skip to content

Commit

Permalink
refactor: rename regex to nested body keys parser
Browse files Browse the repository at this point in the history
  • Loading branch information
talis-fb committed Feb 24, 2024
1 parent d62683d commit f82284b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/utils/regexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ pub mod request_items {
BODY_VALUE_REGEX.get_or_init(|| Regex::new(r"^(?<key>[ -~]+)=(?<value>[ -~]+)$").unwrap())
}

static NESTED_KEYS_VALUES_REGEX: OnceLock<Regex> = OnceLock::new();
pub fn nested_keys_values() -> &'static Regex {
NESTED_KEYS_VALUES_REGEX.get_or_init(|| {
static NESTED_BODY_KEYS_REGEX: OnceLock<Regex> = OnceLock::new();
pub fn nested_body_keys() -> &'static Regex {
NESTED_BODY_KEYS_REGEX.get_or_init(|| {
Regex::new(r"^(?<root_key>[^\[\]]+)(?<sub_keys>(\[([^\[\]]+)\])+)$").unwrap()
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/view/input_parsers/request_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ mod parsers_request_items {
// Key[SubKey1][SubKey2] => Key, [SubKey1, SubKey2]
// ----
let (root_key, sub_keys) = {
let re = regexes::request_items::nested_keys_values();
let re = regexes::request_items::nested_body_keys();
let matcher = re.captures(key)?;

(
Expand Down

0 comments on commit f82284b

Please sign in to comment.