refactor($http): improve readability on conditional assignment

Use ternary operator instead of if statement

Closes #5065