Extract HTTP logic into a separate module

Isolate the HTTP concerns in separate module. We can concentrate on the API specifics in the main file.