baseUrl can be a string or an uri template

BaseUrl can be a string or an uri template. I've copied the functionality from the Client class.