This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use method as cache key prefix for non-GET requests. (#75)
The response for a HEAD request shouldn't be served in response to a GET request. In practice, HEAD responses contain http.noBody values, which return empty body if you try to read them. Prior to this change, that's what happened if you hit a server with a HEAD request and then GET the same URL. The GET response would be incorrectly served from cache with an empty body (that of the HEAD response). Rather than prefix all keys, we add prefixing to non-GET requests only. As well as saving the cost of a string concatenation, it ensures existing disk caches can upgrade without completely invalidating.
- Loading branch information