Skip to content

Commit a525c03

Browse files
Update to .NET 10 GA packages (#2315)
* Use .NET 10 GA packages * Disable GET/HEAD with body on .NET 4.8 because it's not reliable
1 parent 15430d5 commit a525c03

File tree

5 files changed

+13
-22
lines changed

5 files changed

+13
-22
lines changed

Directory.Packages.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
</PropertyGroup>
55
<PropertyGroup Label="Package versions for .NET 10" Condition="'$(TargetFramework)' == 'net10.0'">
6-
<MicrosoftTestHostVer>10.0.0-rc.2.25502.107</MicrosoftTestHostVer>
7-
<SystemTextJsonVer>10.0.0-rc.2.25502.107</SystemTextJsonVer>
6+
<MicrosoftTestHostVer>10.0.0</MicrosoftTestHostVer>
7+
<SystemTextJsonVer>10.0.0</SystemTextJsonVer>
88
</PropertyGroup>
99
<PropertyGroup Label="Package versions for .NET 9" Condition="'$(TargetFramework)' == 'net9.0'">
1010
<MicrosoftTestHostVer>9.0.10</MicrosoftTestHostVer>
@@ -46,7 +46,7 @@
4646
<PackageVersion Include="Xunit.Extensions.Logging" Version="1.1.0" />
4747
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" PrivateAssets="All" />
4848
<PackageVersion Include="xunit" Version="2.9.2" />
49-
<PackageVersion Include="WireMock.Net" Version="1.15.0" />
49+
<PackageVersion Include="WireMock.Net" Version="1.16.0" />
5050
<PackageVersion Include="WireMock.Net.FluentAssertions" Version="1.5.51" />
5151
</ItemGroup>
5252
</Project>

test/RestSharp.Tests.Integrated/CompressionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public async Task Can_Handle_Deflate_Compressed_Content() {
3131
var body = await GetBody(s => new DeflateStream(s, CompressionMode.Compress, true), value);
3232
ConfigureServer(server, body, "deflate");
3333

34-
using var client = new RestClient(server.Url!);
34+
using var client = new RestClient(server.Url!, options => options.AutomaticDecompression = DecompressionMethods.Deflate);
3535
var request = new RestRequest("");
3636
var response = await client.ExecuteAsync(request);
3737

test/RestSharp.Tests.Integrated/NonProtocolExceptionHandlingTests.cs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,7 @@ class StupidClass {
1616

1717
readonly WireMockServer _server = WireMockServer.Start();
1818

19-
/// <summary>
20-
/// Success of this test is based largely on the behavior of your current DNS.
21-
/// For example, if you're using OpenDNS this will test will fail; ResponseStatus will be Completed.
22-
/// </summary>
23-
[Fact]
24-
public async Task Handles_Non_Existent_Domain() {
25-
using var client = new RestClient("http://nonexistantdomainimguessing.org");
26-
27-
var request = new RestRequest("foo");
28-
var response = await client.ExecuteAsync(request);
29-
30-
response.ResponseStatus.Should().Be(ResponseStatus.Error);
31-
}
32-
19+
#if NET
3320
[Fact]
3421
public async Task Handles_HttpClient_Timeout_Error() {
3522
using var client = new RestClient(new HttpClient { Timeout = TimeSpan.FromMilliseconds(500) });
@@ -38,8 +25,9 @@ public async Task Handles_HttpClient_Timeout_Error() {
3825
var response = await client.ExecuteAsync(request);
3926

4027
response.ErrorException.Should().BeOfType<TaskCanceledException>();
41-
response.ResponseStatus.Should().Be(ResponseStatus.TimedOut);
28+
response.ResponseStatus.Should().Be(ResponseStatus.TimedOut, response.ErrorMessage);
4229
}
30+
#endif
4331

4432
[Fact]
4533
public async Task Handles_Server_Timeout_Error() {
@@ -65,7 +53,7 @@ public async Task Handles_Server_Timeout_Error_With_Deserializer() {
6553
}
6654

6755
[Fact]
68-
public async Task Task_Handles_Non_Existent_Domain() {
56+
public async Task Handles_Non_Existent_Domain() {
6957
using var client = new RestClient("http://this.cannot.exist:8001");
7058

7159
var request = new RestRequest("/") {
@@ -75,7 +63,6 @@ public async Task Task_Handles_Non_Existent_Domain() {
7563
var response = await client.ExecuteAsync<StupidClass>(request);
7664

7765
response.ErrorException.Should().BeOfType<HttpRequestException>();
78-
response.ErrorException!.Message.Should().Contain("known");
7966
response.ResponseStatus.Should().Be(ResponseStatus.Error);
8067
}
8168
}

test/RestSharp.Tests.Integrated/RequestBodyTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public sealed class RequestBodyTests : IDisposable {
1212
readonly WireMockServer _server = WireMockServer.Start(s => s.AllowBodyForAllHttpMethods = true);
1313

1414
async Task AssertBody(Method method, bool disableCharset = false) {
15+
#if NET
1516
var options = new RestClientOptions(_server.Url!) { DisableCharset = disableCharset };
1617
using var client = new RestClient(options);
1718
var request = new RestRequest(RequestBodyCapturer.Resource, method);
@@ -25,6 +26,7 @@ async Task AssertBody(Method method, bool disableCharset = false) {
2526

2627
var expected = disableCharset ? ExpectedTextContentTypeNoCharset : ExpectedTextContentType;
2728
AssertHasRequestBody(capturer, expected, bodyData);
29+
#endif
2830
}
2931

3032
[Fact]

test/RestSharp.Tests.Integrated/RequestTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public async Task Can_Perform_GET_Async() {
5050
response.Content.Should().Be(val);
5151
}
5252

53+
#if NET
5354
[Fact]
5455
public async Task Can_Timeout_GET_Async() {
5556
var request = new RestRequest("timeout").AddBody("Body_Content");
@@ -59,8 +60,9 @@ public async Task Can_Timeout_GET_Async() {
5960

6061
var response = await _client.ExecuteAsync(request);
6162

62-
Assert.Equal(ResponseStatus.TimedOut, response.ResponseStatus);
63+
response.ResponseStatus.Should().Be(ResponseStatus.TimedOut, response.ErrorMessage);
6364
}
65+
#endif
6466

6567
[Fact]
6668
public async Task Can_Perform_Delete_With_Response_Type() {

0 commit comments

Comments
 (0)