Repository navigation
fix(listen): join the forwarding URL path and the event path with a single slash - #478
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
…ingle slash Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Fixes #475.
processAttemptbuilds the forwarded URL ascfg.URL.Path + webhookEvent.Body.Path, so a forwarding URL whose path ends in/(hookdeck listen http://127.0.0.1:47913/base/ <source>) sends every request to/base//webhookinstead of/base/webhook.The two paths are now joined by
joinForwardPath, which drops one trailing/from the forwarding URL's path when the event path starts with/. The event path is otherwise kept as is, since a receiver may route on its own trailing slash (which is whypath.Joinis not used), and an empty event path still forwards to the forwarding URL's path unchanged.forward_path_test.goruns one attempt throughprocessAttemptagainst a local server for six cases: forwarding path with and without a trailing slash, the root, no path, an event path with its own trailing slash, and an empty event path. On master the three cases whose forwarding path ends in/(/base/,/and an event path with its own trailing slash) fail with//; with this change all six pass.go vet ./...passes.go test ./...passes apart from two tests in packages this change does not touch, which fail the same way on master in the container used:TestCheckServerHealth_DefaultPorts/HTTPS_default_port(needs an outbound connection to port 443) andTestLogin_rejectedKeyHeadlessFailsFastinpkg/login. The acceptance tests were not run.The issue also notes that a query string on the forwarding URL is dropped; that is not changed here, since forwarding it or rejecting it at startup is a behaviour choice.
This change was prepared with Claude Code.