gregjones/httpcache — pull request #7 by sqs (2013-09-13 23:34:02+00:00)
Title: Expose cached responses via public API function CachedResponse

This PR adds a new exported function `CachedResponse` to let library users access cached responses. Without this function, they would have to separately reimplement the logic to generate a cache key from a response and to read HTTP response bytes into an `*http.Response`. These are both straightforward now, but if the library's logic changes, library users would be left with conflicting implementations.

My immediate motivation for allowing library users to access cached responses is that I want to have `httpcache.Transport` use a custom `RoundTripper` that varies behavior based on the age of the cached response. With this patch, it is easy to examine the response in downstream `RoundTripper`s.

Much of the diff is the result of outdenting a block; not that much actually changed.