Fix caching behaviour when using custom responses.

With a shared cache, rewriting the response hashes to use relative URLs
causes these rewritten responses to be saved into the cache. To avoid
causing a problem if multiple API clients connect with different
settings, we can cache the RestClient response instead of the
transformed Response object.