Repository navigation
[v2] containerinfra: Fix wrong HTTP method and path in certificate create test - #3953
Merged
Merged
Conversation
…test
The HandleCreateCertificateSuccessfully fixture registered its handler
at "/v1/certificates/" (with trailing slash) and asserted the request
method was GET, but certificates.Create issues a POST to
"/v1/certificates" (without trailing slash).
This worked by accident prior to Go 1.26: the ServeMux redirected
requests from "/v1/certificates" to "/v1/certificates/" via 301, and
Go's HTTP client changed POST to GET when following a 301 redirect. Go
1.26 changed these trailing-slash redirects to use 307 instead [1],
which preserves the original method, so POST now arrives at the handler
unchanged and the incorrect assertion fails.
Fix by matching the actual URL ("/v1/certificates", no trailing slash)
and asserting the correct method (POST).
[1] https://go.dev/doc/go1.26
Signed-off-by: Stephen Finucane <[email protected]>
Assisted-By: Claude Opus 4.6 <[email protected]>
mandre
approved these changes
Aug 17, 2026
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.
Backport: #3946
The
HandleCreateCertificateSuccessfullyfixture registered its handler at/v1/certificates/(with trailing slash) and asserted the request method wasGET, butcertificates.Createissues aPOSTto/v1/certificates(without trailing slash).This worked by accident prior to Go 1.26: the
ServeMuxredirected requests from/v1/certificatesto/v1/certificates/via 301, and Go's HTTP client changedPOSTtoGETwhen following a 301 redirect. Go 1.26 changed these trailing-slash redirects to use 307 instead, which preserves the original method, soPOSTnow arrives at the handler unchanged and the incorrect assertion fails.Fix by matching the actual URL (
/v1/certificates, no trailing slash) and asserting the correct method (POST).Fixes #3898