Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ To share a cache across multiple handlers or consumers, use a single `ReplicantC
```cs
var content = await httpCache.StringAsync("https://httpbin.org/json");
```
<sup><a href='/src/Tests/HttpCacheTests.cs#L287-L291' title='Snippet source file'>snippet source</a> | <a href='#snippet-string' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/HttpCacheTests.cs#L288-L292' title='Snippet source file'>snippet source</a> | <a href='#snippet-string' title='Start of snippet'>anchor</a></sup>
<a id='snippet-string-1'></a>
```cs
var lines = new List<string>();
Expand All @@ -186,7 +186,7 @@ await foreach (var line in httpCache.LinesAsync("https://httpbin.org/json"))
lines.Add(line);
}
```
<sup><a href='/src/Tests/HttpCacheTests.cs#L302-L310' title='Snippet source file'>snippet source</a> | <a href='#snippet-string-1' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/HttpCacheTests.cs#L303-L311' title='Snippet source file'>snippet source</a> | <a href='#snippet-string-1' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -197,7 +197,7 @@ await foreach (var line in httpCache.LinesAsync("https://httpbin.org/json"))
```cs
var bytes = await httpCache.BytesAsync("https://httpbin.org/json");
```
<sup><a href='/src/Tests/HttpCacheTests.cs#L321-L325' title='Snippet source file'>snippet source</a> | <a href='#snippet-bytes' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/HttpCacheTests.cs#L322-L326' title='Snippet source file'>snippet source</a> | <a href='#snippet-bytes' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -208,7 +208,7 @@ var bytes = await httpCache.BytesAsync("https://httpbin.org/json");
```cs
using var stream = await httpCache.StreamAsync("https://httpbin.org/json");
```
<sup><a href='/src/Tests/HttpCacheTests.cs#L336-L340' title='Snippet source file'>snippet source</a> | <a href='#snippet-stream' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/HttpCacheTests.cs#L337-L341' title='Snippet source file'>snippet source</a> | <a href='#snippet-stream' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -219,7 +219,7 @@ using var stream = await httpCache.StreamAsync("https://httpbin.org/json");
```cs
await httpCache.ToFileAsync("https://httpbin.org/json", targetFile);
```
<sup><a href='/src/Tests/HttpCacheTests.cs#L353-L357' title='Snippet source file'>snippet source</a> | <a href='#snippet-ToFile' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/HttpCacheTests.cs#L354-L358' title='Snippet source file'>snippet source</a> | <a href='#snippet-ToFile' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -230,7 +230,7 @@ await httpCache.ToFileAsync("https://httpbin.org/json", targetFile);
```cs
await httpCache.ToStreamAsync("https://httpbin.org/json", targetStream);
```
<sup><a href='/src/Tests/HttpCacheTests.cs#L374-L378' title='Snippet source file'>snippet source</a> | <a href='#snippet-ToStream' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/HttpCacheTests.cs#L375-L379' title='Snippet source file'>snippet source</a> | <a href='#snippet-ToStream' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -245,7 +245,7 @@ using var response = new HttpResponseMessage(HttpStatusCode.OK)
};
await httpCache.AddItemAsync(uri, response);
```
<sup><a href='/src/Tests/HttpCacheTests.cs#L439-L447' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddItem' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/HttpCacheTests.cs#L440-L448' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddItem' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -258,7 +258,7 @@ If an error occurs when re-validating a potentially stale item, then the cached
```cs
var content = httpCache.StringAsync(uri, staleIfError: true);
```
<sup><a href='/src/Tests/HttpCacheTests.cs#L524-L528' title='Snippet source file'>snippet source</a> | <a href='#snippet-staleIfError' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/HttpCacheTests.cs#L525-L529' title='Snippet source file'>snippet source</a> | <a href='#snippet-staleIfError' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -272,7 +272,7 @@ By default, 404 responses are not cached and throw an exception. Set `cache404:
await using var cache = new HttpCache(cacheDirectory, cache404: true);
var content = await cache.StringAsync(uri);
```
<sup><a href='/src/Tests/HttpCacheTests.cs#L539-L544' title='Snippet source file'>snippet source</a> | <a href='#snippet-cache404' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/HttpCacheTests.cs#L540-L545' title='Snippet source file'>snippet source</a> | <a href='#snippet-cache404' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down Expand Up @@ -327,7 +327,7 @@ await using var cache = new HttpCache(
minFreshness: TimeSpan.FromHours(1));
var content = await cache.StringAsync("https://httpbin.org/json");
```
<sup><a href='/src/Tests/HttpCacheTests.cs#L554-L561' title='Snippet source file'>snippet source</a> | <a href='#snippet-MinFreshness' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/HttpCacheTests.cs#L555-L562' title='Snippet source file'>snippet source</a> | <a href='#snippet-MinFreshness' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -346,7 +346,7 @@ var content = await httpCache.StringAsync(
message.Headers.Add("Key2", "Value2");
});
```
<sup><a href='/src/Tests/HttpCacheTests.cs#L390-L400' title='Snippet source file'>snippet source</a> | <a href='#snippet-ModifyRequest' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Tests/HttpCacheTests.cs#L391-L401' title='Snippet source file'>snippet source</a> | <a href='#snippet-ModifyRequest' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NoWarn>CS1591;NU1608;NU1109</NoWarn>
<Version>3.2.0</Version>
<Version>3.3.0</Version>
<LangVersion>preview</LangVersion>
<AssemblyVersion>1.0.0</AssemblyVersion>
<PackageTags>HttpClient, HttpCache, Cache</PackageTags>
Expand Down
8 changes: 4 additions & 4 deletions src/Replicant/Replicant.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net48;net8.0;net9.0;net10.0;net11.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net48;net8.0;net9.0;net10.0;net11.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
<TargetFrameworks>net8.0;net9.0;net10.0;net11.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net8.0;net9.0;net10.0;net11.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" />
Expand All @@ -12,9 +12,9 @@
<PackageReference Include="Polyfill" PrivateAssets="all" />
<PackageReference Include="ProjectDefaults" PrivateAssets="all" />
<PackageReference Include="Microsoft.Sbom.Targets" PrivateAssets="all" Condition="'$(CI)' == 'true'" />
<PackageReference Include="System.Net.Http" Condition="$(TargetFramework) == 'net48'" />
<PackageReference Include="System.Net.Http" Condition="$(TargetFramework) == 'net48' Or $(TargetFramework) == 'netstandard2.0'" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net48'">
<ItemGroup Condition="'$(TargetFramework)' == 'net48' Or '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Text.Json" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
Request: {
Uri: https://httpbin.org/etag/{etag},
Headers: {
If-Modified-Since: Wed, 01 Apr 2026 11:26:02 GMT,
If-Modified-Since: DateTime_2,
If-None-Match: "{etag}"
}
},
Expand All @@ -36,7 +36,7 @@
Headers: {
Access-Control-Allow-Credentials: true,
Access-Control-Allow-Origin: *,
Date: DateTime_1,
Date: DateTime_3,
ETag: {etag}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Tests/HttpCacheTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ public async Task ExpiredShouldNotSendEtagOrIfModifiedSince()
Recording.Start();
result = await httpCache.DownloadAsync(uri);
await Verify(result)
.IgnoreMembers("traceparent", "Traceparent");
.IgnoreMembers("traceparent", "Traceparent")
.ScrubInlineDateTimes("ddd, dd MMM yyyy HH:mm:ss 'GMT'");
}

[Test]
Expand Down
Loading