Skip to content

Conversation

felixkamau
Copy link
Contributor

What kind of change does this PR introduce?

Refactor

What is the current behavior?

The _handleRequest method uses an if-else statement to conditionally assign the streamedResponse variable based on whether httpClient is null or not. The logic spans multiple lines and uses a commented-out block.

What is the new behavior?

The same conditional logic is now implemented using a ternary operator, making the code more concise and readable

@felixkamau felixkamau changed the title Storage refactor: Simplify httpClient conditional logic using ternary operator Jul 21, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 16415550728

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 80.623%

Totals Coverage Status
Change from base Build 16305074338: 0.0%
Covered Lines: 3104
Relevant Lines: 3850

💛 - Coveralls

// } else {
// streamedResponse = await request.send();
// }
streamedResponse = httpClient != null

Choose a reason for hiding this comment

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

Why this change, is there a special reason? what is wrong with old implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The logic is self contained in one expression

Choose a reason for hiding this comment

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

but what are the benefit or a bug does this fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just refactoring

@Vinzent03
Copy link
Collaborator

I prefer the current style and it's easier to extend.

@Vinzent03 Vinzent03 closed this Jul 21, 2025
@felixkamau felixkamau deleted the storage branch July 21, 2025 14:08
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.

4 participants