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

Fix headers forwarding when forwarding artifacts requests to the package storage #928

Merged
merged 1 commit into from
Dec 7, 2022

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Dec 7, 2022

We were doing the headers forwarding after writing the body, but ResponseWriter.Write() can set its own headers when others are not found.
Set the headers before doing any write in the response.

@jsoriano jsoriano requested review from a team December 7, 2022 15:52
@jsoriano jsoriano self-assigned this Dec 7, 2022
Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

Code LGTM - thank you for tracking this down. Seems like a very not obvious bug to find. 🚀

file: "1password-logo-light-bg.svg.response",
responseHeaders: map[string]string{
"Last-Modified": "time",
"Content-Type": "image/svg+xml",
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding this to the tests 👍

Comment on lines +43 to +44
// Set headers before setting the body. If not, first call to w.Write will
// add some default values.
Copy link
Member

Choose a reason for hiding this comment

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

Good find here!

@elasticmachine
Copy link

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-12-07T15:52:34.746+0000

  • Duration: 5 min 4 sec

Test stats 🧪

Test Results
Failed 0
Passed 244
Skipped 0
Total 244

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@jsoriano jsoriano merged commit 768c326 into elastic:main Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants