Simplify the ternary operator in Http:send() and some code cleanup

The ternary to set the `$json` variable was pretty nested. A simple `if` would make it more readable.

This also includes some code cleanup in improve readability.