Skip to content

Conversation

javirln
Copy link
Member

@javirln javirln commented Mar 3, 2025

This pull request includes an improvement to the loadFromURL function in the pkg/resourceloader/resourceloader.go file. The change ensures better error handling when loading content from a URL.

Improvements to error handling:

  • pkg/resourceloader/resourceloader.go: Added a check to ensure the HTTP response status is OK before attempting to read the response body. If the status is not OK, an error is returned with the status message.

Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln javirln requested review from jiparis and migmartri March 3, 2025 11:51
@javirln javirln self-assigned this Mar 3, 2025
defer resp.Body.Close()

// Check if the response is OK
if resp.StatusCode != http.StatusOK {
Copy link
Member

Choose a reason for hiding this comment

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

what about redirections, should we follow them?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added a comment about that. By default the http.Get performs a maximum of 10 redirections

@javirln javirln merged commit e6b295b into chainloop-dev:main Mar 3, 2025
13 checks passed
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