Move witness API path component into gateway implementation - #1072
Merged
Conversation
AlCutter
force-pushed
the
witness_api_tidy
branch
from
July 23, 2026 11:49
a36fe9b to
21bff3e
Compare
roger2hk
approved these changes
Jul 23, 2026
Comment on lines
+128
to
+131
| // Can't use path.Join here as it'll nobble the double-slash in URLs. | ||
| // url.JoinPath returns an error, which we can't handle here, but we already know that the URL is valid since | ||
| // it's coming via WitnessGroup.WitnessEndpoints(). So we'll just do the string manipulation ourselves. | ||
| url: strings.TrimRight(u, "/") + "/add-checkpoint", |
Contributor
There was a problem hiding this comment.
Could the / be trimmed in WitnessGroup.WitnessEndpoints()? This would ensure all URLs are aligned at the source.
Collaborator
Author
There was a problem hiding this comment.
Seems more correct to do it here; if it weren't for the potential to return an error, I'd have just used url.JoinPath here which would have done this normalisation internally.
AlCutter
force-pushed
the
witness_api_tidy
branch
from
July 23, 2026 14:41
407466f to
21bff3e
Compare
AlCutter
force-pushed
the
witness_api_tidy
branch
from
July 23, 2026 14:46
21bff3e to
7a93a76
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move the witness API path detail out of the policy code and into the gateway implementation.
The witness policy handling code shouldn't care about the individual API path(s) on a witness, just its root URL.
Towards #945