From 707fd288eb15b636bdba0b9429ed3b864e5a85ae Mon Sep 17 00:00:00 2001 From: Carlos Date: Wed, 4 Oct 2023 20:59:16 -0300 Subject: [PATCH] mock: ensure the http client doesn't cache --- storeapi/base/impl/WinMockContext.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/storeapi/base/impl/WinMockContext.cpp b/storeapi/base/impl/WinMockContext.cpp index a4d39decc..9f929f2cd 100644 --- a/storeapi/base/impl/WinMockContext.cpp +++ b/storeapi/base/impl/WinMockContext.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -181,7 +182,13 @@ IAsyncOperation buildUri(winrt::hstring& relativePath, IAsyncOperation call(winrt::hstring relativePath, UrlParams const& params) { // Initialize only once. - static winrt::Windows::Web::Http::HttpClient httpClient{}; + namespace http = winrt::Windows::Web::Http; + static http::Filters::HttpBaseProtocolFilter filter{}; + filter.CacheControl().ReadBehavior( + http::Filters::HttpCacheReadBehavior::NoCache); + filter.CacheControl().WriteBehavior( + http::Filters::HttpCacheWriteBehavior::NoCache); + static http::HttpClient httpClient{filter}; Uri uri = co_await buildUri(relativePath, params);