Skip to content

Set a default HTTP client for DefaultFetcher in DownloadFile method if none is set #686

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

Conversation

malancas
Copy link
Contributor

@malancas malancas commented May 8, 2025

If someone instantiates a new DefaultFetcher directly with DefaultFetcher{} instead of with the new constructor , DownloadFile will fail because the client field has not been set. This pull request updates DownloadFile to check if the client field is nil and sets a default HTTP client if it is to avoid breaking current usage of DefaultFetcher.

…t client

Signed-off-by: Meredith Lancaster <malancas@github.com>
@malancas malancas changed the title Set a default HTTP client for DefaultFetcher if none is set Set a default HTTP client for DefaultFetcher in DownloadFile method if none is set May 8, 2025
@malancas malancas marked this pull request as ready for review May 8, 2025 20:08
@malancas malancas requested a review from a team as a code owner May 8, 2025 20:08
Signed-off-by: Meredith Lancaster <malancas@github.com>
Copy link
Contributor

@rdimitrov rdimitrov left a comment

Choose a reason for hiding this comment

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

Nice catch 🚀

Copy link
Member

@kommendorkapten kommendorkapten left a comment

Choose a reason for hiding this comment

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

Nice work.

@kommendorkapten kommendorkapten merged commit 7dec1ec into theupdateframework:master May 9, 2025
23 checks passed
@malancas malancas deleted the create-http-client-if-not-set branch May 9, 2025 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants