Code Monkey home page Code Monkey logo

Comments (5)

zhao-kun avatar zhao-kun commented on June 12, 2024

URL decoding (encoding) is a common scenario in the traffic orchestration system. I suggest providing users with helper functions for use in builder filters or predefined filter options.

from easegress.

suchen-sci avatar suchen-sci commented on June 12, 2024

As far as I know, I can't find a better way to extend the template functions except make a new pr for it? So, if you like, feel free to make a pr for it and please make sure to update the corresponding documentation.

By the way, with newest easegress, you can simplify

{{.responses.DEFAULT.JSONBody.data | urldecode}}

to

{{.resp.JSONBody.data | urldecode}}

Please check https://github.com/easegress-io/easegress/blob/main/docs/07.Reference/7.02.Filters.md#template-of-builder-filters for more details.

from easegress.

KevinQiangK avatar KevinQiangK commented on June 12, 2024

As far as I know, I can't find a better way to extend the template functions except make a new pr for it? So, if you like, feel free to make a pr for it and please make sure to update the corresponding documentation.

By the way, with newest easegress, you can simplify

{{.responses.DEFAULT.JSONBody.data | urldecode}}

to

{{.resp.JSONBody.data | urldecode}}

Please check https://github.com/easegress-io/easegress/blob/main/docs/07.Reference/7.02.Filters.md#template-of-builder-filters for more details.

Thank you for your suggestion. I will create a pull request to address this issue by adding the 'urlQueryEscape' and 'urlQueryUnescape' template functions to the builtin extraFuncs .

from easegress.

suchen-sci avatar suchen-sci commented on June 12, 2024

#1194

from easegress.

KevinQiangK avatar KevinQiangK commented on June 12, 2024

#1194 I have implemented the 'urlQueryEscape' and 'urlQueryUnescape' template functions and added them to the builtin extraFuncs. You can now utilize them as follows:

{{.resp.JSONBody.data | urlQueryUnescape}}

from easegress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.