Skip to content

Commit

Permalink
Add support for htmlEscape and htmlUnescape in hurlfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ad8lmondy committed Dec 6, 2022
1 parent 4f616a4 commit 7dd469f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/hurlfmt/src/format/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,15 @@ impl ToJson for FilterValue {
FilterValue::UrlDecode { .. } => {
attributes.push(("type".to_string(), JValue::String("urlDecode".to_string())));
}
FilterValue::HtmlEscape { .. } => {
attributes.push(("type".to_string(), JValue::String("htmlEscape".to_string())));
}
FilterValue::HtmlUnescape { .. } => {
attributes.push((
"type".to_string(),
JValue::String("htmlUnescape".to_string()),
));
}
FilterValue::ToInt { .. } => {
attributes.push(("type".to_string(), JValue::String("toInt".to_string())));
}
Expand Down
4 changes: 4 additions & 0 deletions packages/hurlfmt/src/format/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,10 @@ impl Tokenizable for Filter {
FilterValue::Count { .. } => vec![Token::FilterType(String::from("count"))],
FilterValue::UrlEncode { .. } => vec![Token::FilterType(String::from("urlEncode"))],
FilterValue::UrlDecode { .. } => vec![Token::FilterType(String::from("urlDecode"))],
FilterValue::HtmlEscape { .. } => vec![Token::FilterType(String::from("htmlEscape"))],
FilterValue::HtmlUnescape { .. } => {
vec![Token::FilterType(String::from("htmlUnescape"))]
}
FilterValue::ToInt { .. } => vec![Token::FilterType(String::from("toInt"))],
}
}
Expand Down

0 comments on commit 7dd469f

Please sign in to comment.