test(updateclihttp): add request header assertion and test cases#7815
Open
ak95asb wants to merge 3 commits intoupdatecli:mainfrom
Open
test(updateclihttp): add request header assertion and test cases#7815ak95asb wants to merge 3 commits intoupdatecli:mainfrom
ak95asb wants to merge 3 commits intoupdatecli:mainfrom
Conversation
Resolve a TODO at source_test.go to verify that custom HTTP request headers specified via spec.request.headers are actually forwarded on the wire. The mock's DoFunc now iterates over tt.spec.Request.Headers and fails the test if the header value on the outgoing request does not match the spec. Two new table-driven test cases are added: - "Normal case with single request header" (Authorization) - "Normal case with multiple request headers" (Authorization + X-Custom-Header)
Contributor
Author
|
Hi @olblak, I am new to Go and open source development in general. |
Member
|
Hi @ak95asb, |
Contributor
Author
|
Hi @olblak, |
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.
Summary
Resolves the
// TODO: check headerscomment insource_test.go:140.The mock's
DoFuncnow iterates overtt.spec.Request.Headersandreturns an error if any header on the outgoing request doesn't match
the spec — ensuring headers set via
spec.request.headersare actuallyforwarded on the wire.
Two new table-driven test cases added:
Authorization)Authorization+X-Custom-Header)Test plan
go test ./pkg/plugins/resources/updateclihttp/... -run TestSource— all 8 cases pass