Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CacheCow is not caching (.NET 5.0) #263

Closed
matteoventuri7 opened this issue Aug 6, 2021 · 2 comments
Closed

CacheCow is not caching (.NET 5.0) #263

matteoventuri7 opened this issue Aug 6, 2021 · 2 comments

Comments

@matteoventuri7
Copy link

This unit test fail on .NET 5.0

var client = ClientExtensions.CreateClient();
const string CacheableResource = "https://code.jquery.com/jquery-3.3.1.slim.min.js";
var response = await client.GetAsync(CacheableResource);
var responseFromCache = await client.GetAsync(CacheableResource);
Assert.AreEqual(false, response.Headers.GetCacheCowHeader().RetrievedFromCache);
Assert.AreEqual(true, responseFromCache.Headers.GetCacheCowHeader().RetrievedFromCache);
@aliostad
Copy link
Owner

aliostad commented Aug 6, 2021

Thanks for reporting. I will look into it but have a feeling is related to #213 which is just fixed during .NET 5.0.

They tried to fix it twice they messed up twice. This will be the 3rd time.

@aliostad
Copy link
Owner

OK, apologies for not being able to look into it.

There is no problem in .NET 5.0, one of the tests do not work which I am looking into.

As for your example your assert is wrong. It fails on first time round in fact, since you expect false while it is null.
Change it so you can see:

        [Fact]
        public async Task Simple_Caching_Example_From_Issue263()
        {
            var client = ClientExtensions.CreateClient();
            const string CacheableResource = "https://code.jquery.com/jquery-3.3.1.slim.min.js";
            var response = await client.GetAsync(CacheableResource);
            var responseFromCache = await client.GetAsync(CacheableResource);
            Assert.Equal(true, response.Headers.GetCacheCowHeader().DidNotExist);
            Assert.Equal(true, responseFromCache.Headers.GetCacheCowHeader().RetrievedFromCache);
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants