Skip to content
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

chore: add unit tests to headerforwarder package #512

Merged
merged 5 commits into from
Nov 27, 2024

Conversation

potterbm-cb
Copy link
Contributor

Motivation

This utility was part of a proof-of-concept and this is an attempt to move it closer to a production-ready state

Solution

HeaderForwarder and headerforwarder.ResponseWriter were not tested, lacking specific code/documentation about edge cases

This PR adds those tests and fixes some issues uncovered by the testing

@cb-heimdall
Copy link

cb-heimdall commented Nov 27, 2024

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@@ -132,7 +132,14 @@ func (hf *HeaderForwarder) rememberHeaders(req *http.Request, resp *http.Respons

// Only remember interesting headers
for _, interestingHeader := range hf.interestingHeaders {
headersToRemember.Set(interestingHeader, resp.Header.Get(interestingHeader))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line was overwriting each header value, not adding

@potterbm-cb potterbm-cb merged commit 06d0fe9 into master Nov 27, 2024
11 checks passed
@potterbm-cb potterbm-cb deleted the bryan/chore-add-unit-tests branch November 27, 2024 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants