Function that sends a HTTP request, returning promise.