-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat!: Matches required query parameters #21
Conversation
Draft commit for using ipfs/go-ipfs-redirects-file#21 to allow query parameters in redirects. Cannot be completed/will not be ready until that PR is merged, and a new version released (so go.mod/go.sum can be updated here)
Draft commit for using ipfs/go-ipfs-redirects-file#21 to allow query parameters in redirects. Cannot be completed/will not be ready until that PR is merged, and a new version released (so go.mod/go.sum can be updated here)
efc53cb
to
17de3f8
Compare
"/fixed-val val=val /to 200\n/dynamic-val val=:val /to/:val 301\n/empty-val val= /to 404\n/any-val val /to 302\n", | ||
"/multi-query val1=val1 val2=:val2 val3= val4 /to/:val2\n/multi-query2 val1=val1 val2=:val2 val3= val4 /to/:val2 302\n", | ||
"/bad-syntax1 val=a&val=b /to\n", "/bad-syntax2 val=a&val2=b /to 302\n", "/a ^¬params /b\n", "/bad-status type=:type /to 3oo\n", "/bad-chars :type=whatever /to\n", "/bad-chars type=what:ever /to\n", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't 100% clear on the fuzz testing strategy here, I'd appreciate a closer look at whether I've chosen suitable testcases here.
Code now parses and `MatchAndExpandPlaceholders` for query parameters as well as paths. Placeholders are shared between the two. This commit codifies some of the previously implicit edgecases, particularly around duplicate placeholders. Closes ipfs#20
(turning to a draft until we have an IPIP mentioned in #20) |
Closing as the IPIP did not happen + we went with simpler support – details in #20 (comment) |
Code now
Parse
s andMatchAndExpandPlaceholders
for query parameters as well as paths. I ended up implementing #20 without waiting for a discussion on the issue, for which I apologise! I'll be happy to rewrite without a review if there are concerns with the proposal.Placeholders are shared between the two.
This is a breaking change for the package's API (though not for the
_redirects
file format), as the query params need to be passed intoMatchAndExpandPlaceholders
. I'll be un-drafting ipfs/boxo#406 (which adapts syntax to include this work), once (if!) this PR is merged, sogo.mod
/go.sum
can be corrected.This commit also codifies in tests some of the previously implicit edge cases, particularly around duplicate placeholders.
Closes #20
If you build a copy of
ipfs
with this in (via ipfs/boxo#406) then you can visit this CID locally and see this in action.