Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.IO;
using System.Linq;
using System.Net.Http.Headers;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -1289,7 +1290,22 @@ public async Task GetAsync_SetAutomaticDecompression_ContentDecompressed_Deflate
handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
using (HttpClient client = CreateHttpClient(handler))
{
Assert.Contains(expectedContent, await client.GetStringAsync(uri));
try
{
using HttpResponseMessage response = await client.GetAsync(uri);
if (response.StatusCode is HttpStatusCode.GatewayTimeout or HttpStatusCode.BadGateway)
{
// Ignore the erroneous status code, the test depends on an external server that is out of our control.
_output.WriteLine(response.ToString());
return;
}
Assert.Contains(expectedContent, await response.Content.ReadAsStringAsync());
}
catch (HttpRequestException hre) when (hre.InnerException is SocketException se && (se.SocketErrorCode is SocketError.WouldBlock or SocketError.TryAgain))
{
// Ignore the exception, the test depends on an external server that is out of our control.
_output.WriteLine(hre.ToString());
}
}
}

Expand Down