diff --git a/CHANGELOG.md b/CHANGELOG.md index f80ffb049a..b15d0d68d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Localhost based descriptions are not cached anymore to facilitate development workflows. [#3316](https://github.com/microsoft/kiota/issues/3316) + ## [1.6.1] - 2023-09-11 ### Changed diff --git a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs index 2cb29c30ac..7bb280c983 100644 --- a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs +++ b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs @@ -84,12 +84,17 @@ private async Task DownloadDocumentFromSourceAsync(Uri documentUri, stri responseMessage.EnsureSuccessStatusCode(); content = new MemoryStream(); await responseMessage.Content.CopyToAsync(content, token).ConfigureAwait(false); + if (documentUri.IsLoopback) + Logger.LogInformation("skipping cache write for URI {Uri} as it is a loopback address", documentUri); + else + { #pragma warning disable CA2007 - await using var fileStream = File.Create(target); + await using var fileStream = File.Create(target); #pragma warning restore CA2007 - content.Position = 0; - await content.CopyToAsync(fileStream, token).ConfigureAwait(false); - await fileStream.FlushAsync(token).ConfigureAwait(false); + content.Position = 0; + await content.CopyToAsync(fileStream, token).ConfigureAwait(false); + await fileStream.FlushAsync(token).ConfigureAwait(false); + } content.Position = 0; return content; }