Ability to override default hostname

For testing purposes it is useful to be able to override the API
hostname.