vendredi 25 mars 2016

Why is cache-control header value backwards when I check against them?

The headers are being appended like so.

context.Response.Headers.Append("Cache-Control", "max-age=0,no-cache,no-store");

When I do an equality check (below) for a unit test, it is failing because the 3 items are in reverse order ("no-store,no-cache,max-age=0") when I read it back.

Assert.IsTrue(resp.Result.Headers.GetValues("Cache-Control")
    .First()
    .Equals("max-age=0,no-cache,no-store"));

Any idea why that could possibly be? Or, a better way to do a comparison for my unit test?

Aucun commentaire:

Enregistrer un commentaire