Before this patch there was not a way to add a query parameter to a URL, removing the previous value if the parameter was already present in the base URL.
But that didn't work since --trim query runs after --append query, so the new value value added with --append also gets trimmed:
$ x 'https://example.org/?foo=hello&baz=boo' 'howdy'
https://example.org/?baz=boo
This patch makes trurl run --trim before --append so that using --trim query=foo --append query=foo=bar works to set foo to bar overwriting previous values of foo.
$ x 'https://example.org/?foo=hello&baz=boo' 'howdy'
https://example.org/?baz=boo&foo=howdy
I added a test for this, and I also added a test that tests that --sort-query and --append query work together, since I noticed it was missing.
Before this patch there was not a way to add a query parameter to a URL, removing the previous value if the parameter was already present in the base URL.
I tried to use:
But that didn't work since --trim query runs after --append query, so the new value value added with --append also gets trimmed:
This patch makes trurl run --trim before --append so that using --trim query=foo --append query=foo=bar works to set foo to bar overwriting previous values of foo.
I added a test for this, and I also added a test that tests that --sort-query and --append query work together, since I noticed it was missing.