use `uri.host` instead of hostname to make it work with ruby < 2
in case response is an array, extract the first element