Skip to content

Commit c258a6f

Browse files
authored
Merge pull request filipw#184 from yue-shi/dev
Use request MediaType if ContentType cache returns null
2 parents 7ea8632 + 0b5f8c3 commit c258a6f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/WebApi.OutputCache.V2/CacheOutputAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public override void OnActionExecuting(HttpActionContext actionContext)
194194
var val = _webApiCache.Get<byte[]>(cachekey);
195195
if (val == null) return;
196196

197-
var contenttype = _webApiCache.Get<MediaTypeHeaderValue>(cachekey + Constants.ContentTypeKey) ?? new MediaTypeHeaderValue(cachekey.Split(new[] { ':' }, 2)[1].Split(';')[0]);
197+
var contenttype = _webApiCache.Get<MediaTypeHeaderValue>(cachekey + Constants.ContentTypeKey) ?? responseMediaType;
198198

199199
actionContext.Response = actionContext.Request.CreateResponse();
200200
actionContext.Response.Content = new ByteArrayContent(val);

0 commit comments

Comments
 (0)