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

ISSUE-9507: ADD application/gzip,application/octet-stream accept header #13034

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mattclegg
Copy link

What this PR does:
This PR adds the accept header to the request sent by the HTTPGetter when downloading archives.

The function accepts gzip and so it would be preferable if it also notified the server about this. Additionally, this adds support for private helm charts hosted with GitHub.

Special notes for your reviewer:
Issue related to this are #9507

@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 14, 2024
…ader when downloading chart

Signed-off-by: Matt Clegg <m@cle.gg>
@robertsirc
Copy link
Contributor

So, I will ask the question where are the test for this?

Signed-off-by: Matt Clegg <m@cle.gg>
@mattclegg
Copy link
Author

mattclegg commented May 17, 2024

OK, @robertsirc
What would you like to see as a test for this?

or did you have something else in mind?

You may also test with a private repository on GitHub via;

curl -L \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/$OWNER/$REPO/releases/assets/$ASSET_ID

which returns;

...
< content-type: application/json; charset=utf-8
...

but

curl -L \
  -H "Accept: application/octet-stream" \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/$OWNER/$REPO/releases/assets/$ASSET_ID

downloads the asset.

@robertsirc
Copy link
Contributor

Like in httpgetter_test we will expect the useragent and if it isn't correct it throws an error, for example in the test there called TestDownload I am questioning if we should have test to ensure a response if we are looking for it in the code. to remain idomatic of the rest of the codebase.

@mattclegg
Copy link
Author

mattclegg commented May 22, 2024

Thanks for clarifying @robertsirc
Like this; https://github.com/mattclegg/helm/pull/2/files ?

@robertsirc
Copy link
Contributor

@mattclegg yes is this in one PR or two?

@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 24, 2024
@mattclegg
Copy link
Author

@robertsirc The other PRs are to avoid having noise on this branch for other tests that aren't needed.

I've merged the test for the server with varied Accept Header to this branch. Please let me know if there's anything else that needs to be done before this PR can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants