BUG report - HandleValidCache not apply AddHeader attribute

This is a continuation of the work you helped me with in the post below.

CacheInfo not available in GlobalRequestFilter.

My service returns a PDF in a memorystream. I am using the newer CacheResponse attribute, as well as the AddHeader attributes on the service. I am also running a global request filter to strip off possible javascript timestamp information (discussed in the forum thread above). It appears that when I call HandleValidCache in the global request filter, the header information from my service does not get applied.

The result is the PDF is correctly returned the first time, but not if the cache is used.

Sample project is below, with a failing unit test.

https://indians.box.com/s/op1hmu7gs6rnarnakct92zp5h6391j9y

Found the solution myself, had to change the priority of the AddHeader attribute to always happen before the caching…

[AddHeader(ContentType = "application/pdf", Priority = -2)]
[CacheResponse(Priority = -1, Duration = 300)]

Please disregard question.

1 Like