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

querystring functions reimplemented #264

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

akrainiouk
Copy link
Contributor

@akrainiouk akrainiouk commented Feb 20, 2024

This is an alternative to #258 which is only a partial fix.

The behavior of this new implementation is more consistent with Fastly.
The original falco implementation parses the original value into a structure, then manipulates it and then converts back to string representation. This has several unwanted side effects such changing key and value encoding as well as changing parameter order.
Instead of fully parsing the input string, new implementation attempts to only split it to pieces as necessary.
The premise is that split operation is fully reversible with join.
Also new implementation attempts to follow Fastly quirks. For instance in some cases (filter) '?' is automatically removed if operation result leads to empty query. In some other cases (sort) it is preserved even if query string is empty.
This fastly fiddle contains (mostly) the same test cases as those in the associated unit tests.

 so they don't parse query string and instead try to preserve the original as much as possible
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.

1 participant