This repository was archived by the owner on Nov 22, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
src/Microsoft.AspNetCore.ResponseCaching Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ public class ResponseCachingContext
23
23
private CacheControlHeaderValue _requestCacheControl ;
24
24
private CacheControlHeaderValue _responseCacheControl ;
25
25
private DateTimeOffset _responseTime ;
26
+ private static readonly CacheControlHeaderValue EmptyCacheControl = new CacheControlHeaderValue ( ) ;
26
27
27
28
public ResponseCachingContext ( HttpContext httpContext , IResponseCache cache )
28
29
{
@@ -78,7 +79,7 @@ private CacheControlHeaderValue RequestCacheControl
78
79
{
79
80
if ( _requestCacheControl == null )
80
81
{
81
- _requestCacheControl = RequestHeaders . CacheControl ?? new CacheControlHeaderValue ( ) ;
82
+ _requestCacheControl = RequestHeaders . CacheControl ?? EmptyCacheControl ;
82
83
}
83
84
return _requestCacheControl ;
84
85
}
@@ -90,7 +91,7 @@ private CacheControlHeaderValue ResponseCacheControl
90
91
{
91
92
if ( _responseCacheControl == null )
92
93
{
93
- _responseCacheControl = ResponseHeaders . CacheControl ?? new CacheControlHeaderValue ( ) ;
94
+ _responseCacheControl = ResponseHeaders . CacheControl ?? EmptyCacheControl ;
94
95
}
95
96
return _responseCacheControl ;
96
97
}
@@ -329,7 +330,6 @@ internal async Task<bool> TryServeFromCacheAsync()
329
330
330
331
if ( _responseType == ResponseType . HeadersOnly )
331
332
{
332
- response . ContentLength = 0 ;
333
333
responseServed = true ;
334
334
}
335
335
else if ( _responseType == ResponseType . FullReponse )
You can’t perform that action at this time.
0 commit comments