不支持对GET以外的方法返回的Partial内容的缓存

This commit is contained in:
刘祥超
2022-03-04 17:09:12 +08:00
parent 16c123c400
commit 21c80aea78

View File

@@ -101,7 +101,12 @@ func (this *HTTPWriter) Prepare(resp *http.Response, size int64, status int, ena
this.statusCode = status this.statusCode = status
// 是否为区间请求 // 是否为区间请求
this.isPartial = status == http.StatusPartialContent && this.req.Method() != http.MethodHead this.isPartial = status == http.StatusPartialContent
// 不支持对GET以外的方法返回的Partial内容的缓存
if this.isPartial && this.req.Method() != http.MethodGet {
enableCache = false
}
if resp != nil && resp.Body != nil { if resp != nil && resp.Body != nil {
cacheReader, ok := resp.Body.(caches.Reader) cacheReader, ok := resp.Body.(caches.Reader)