Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement 'urlQueryEscape' and 'urlQueryUnescape' template functions in builtin extraFuncs #1194

Conversation

KevinQiangK
Copy link
Contributor

This commit adds the 'urlQueryEscape' and 'urlQueryUnescape' functions to the template's extra functions ('extraFuncs'). These functions provide URL encoding and decoding capabilities.

…in filter builder

This commit adds the 'urlQueryEscape' and 'urlQueryUnescape' functions to the template's extra functions ('extraFuncs'). These functions provide URL encoding and decoding capabilities.
@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (a2c3f72) 79.65% compared to head (ab8d60f) 79.66%.
Report is 1 commits behind head on main.

Files Patch % Lines
pkg/filters/builder/extrafuncs.go 75.00% 1 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1194      +/-   ##
==========================================
+ Coverage   79.65%   79.66%   +0.01%     
==========================================
  Files         153      153              
  Lines       17402    17410       +8     
==========================================
+ Hits        13861    13870       +9     
+ Misses       2866     2865       -1     
  Partials      675      675              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +2074 to +2075
* **urlQueryEscape**: escapes the string so that it can be safely placed inside
a URL query, equivalent to the `urlquery` template function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, what's the difference between urlQueryEscape and urlquery?
And could you please tell me why we need to add urlQueryEscape if there are already urlquery?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

urlquery is a built-in template function in the Go template package, and it has the same implementation as urlQueryEscape. The reason for adding both urlQueryEscape and urlQueryUnescape functions simultaneously serves two purposes:

  1. To provide a clearer expression of functionality, as these functions are implemented using the queryEscape and queryUnescape methods from the url package.
  2. To maintain consistency within Easegress by using symmetric function names.

@suchen-sci suchen-sci added this pull request to the merge queue Jan 12, 2024
Merged via the queue into easegress-io:main with commit b910a82 Jan 12, 2024
8 checks passed
@KevinQiangK KevinQiangK deleted the feat/urlquery-unescape-tempalte-function-1191 branch January 12, 2024 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants