Skip to content

Conversation

@jvoisin
Copy link
Collaborator

@jvoisin jvoisin commented Aug 29, 2025

  • Replace a strings.HasPrefix + strings.Cut with a call to strings.CutPrefix.
  • Instead of enumerating all possible redirection code, check if the code is 300-something.
  • Extract an error constructor outside of its current scope instead of duplicating it 5 times
  • Use constant strings for LocalizedError's return values where possible.

@fguillot fguillot requested a review from Copilot September 10, 2025 03:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR applies several minor refactoring improvements to the response handler fetcher code to make it more readable and maintainable.

  • Modernizes string processing by using strings.CutPrefix and strings.SplitSeq
  • Simplifies HTTP redirect detection with status code range checking
  • Eliminates code duplication by extracting error construction logic

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- Replace a strings.HasPrefix + strings.Cut with a call to strings.CutPrefix.
- Instead of enumerating all possible redirection code, check if the code is
  300-something.
- Extract an error constructor outside of its current scope instead of
  duplicating it 5 times
- Use constant strings for LocalizedError's return values where possible.
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.

2 participants