Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara committed Sep 26, 2024
1 parent fea52aa commit 0d55a95
Show file tree
Hide file tree
Showing 23 changed files with 106 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ await ValidateClientCancellationAsync(async () =>
[InlineData(CancellationMode.CancelPendingRequests, true)]
[InlineData(CancellationMode.DisposeHttpClient, true)]
[SkipOnPlatform(TestPlatforms.Browser, "Browser doesn't have blocking synchronous Stream.ReadByte and so it waits for whole body")]
[SkipOnPlatform(TestPlatforms.Wasi, "Wasi doesn't have blocking synchronous Stream.ReadByte and so it waits for whole body")]
public async Task GetAsync_CancelPendingRequests_DoesntCancelReadAsyncOnResponseStream(CancellationMode mode, bool copyToAsync)
{
if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value)
Expand Down Expand Up @@ -347,6 +348,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) =>

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "MaxConnectionsPerServer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "MaxConnectionsPerServer is not supported on Wasi")]
public async Task MaxConnectionsPerServer_WaitingConnectionsAreCancelable()
{
if (LoopbackServerFactory.Version >= HttpVersion20.Value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(
[Theory]
[MemberData(nameof(CookieNamesValuesAndUseCookies))]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_SetCookieContainer_CookieSent(string cookieName, string cookieValue, bool useCookies)
{
await LoopbackServerFactory.CreateClientAndServerAsync(
Expand Down Expand Up @@ -94,6 +95,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_SetCookieContainerMultipleCookies_CookiesSent()
{
var cookies = new Cookie[]
Expand Down Expand Up @@ -230,6 +232,7 @@ private string GetCookieValue(HttpRequestData request)

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_SetCookieContainerAndCookieHeader_BothCookiesSent()
{
await LoopbackServerFactory.CreateServerAsync(async (server, url) =>
Expand Down Expand Up @@ -258,6 +261,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) =>

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_SetCookieContainerAndMultipleCookieHeaders_BothCookiesSent()
{
await LoopbackServerFactory.CreateServerAsync(async (server, url) =>
Expand Down Expand Up @@ -298,6 +302,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) =>

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsyncWithRedirect_SetCookieContainer_CorrectCookiesSent()
{
if (UseVersion == HttpVersion30)
Expand Down Expand Up @@ -345,6 +350,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async url =>
[Theory]
[MemberData(nameof(CookieNamesValuesAndUseCookies))]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_ReceiveSetCookieHeader_CookieAdded(string cookieName, string cookieValue, bool useCookies)
{
await LoopbackServerFactory.CreateServerAsync(async (server, url) =>
Expand Down Expand Up @@ -377,6 +383,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) =>

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_ReceiveMultipleSetCookieHeaders_CookieAdded()
{
await LoopbackServerFactory.CreateServerAsync(async (server, url) =>
Expand Down Expand Up @@ -417,6 +424,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) =>
// ConditionalFact: CookieContainer does not follow RFC6265 on .NET Framework, therefore the (WinHttpHandler) test is expected to fail
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetFramework))]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_NoPathDefined_CookieAddedWithDefaultPath()
{
await LoopbackServerFactory.CreateServerAsync(async (server, serverUrl) =>
Expand Down Expand Up @@ -447,6 +455,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, serverUrl) =>
// ConditionalFact: CookieContainer does not follow RFC6265 on .NET Framework, therefore the (WinHttpHandler) test is expected to fail
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetFramework))]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_CookiePathDoesNotMatchRequestPath_CookieAccepted()
{
await LoopbackServerFactory.CreateServerAsync(async (server, serverUrl) =>
Expand Down Expand Up @@ -479,6 +488,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, serverUrl) =>
// ConditionalFact: CookieContainer does not follow RFC6265 on .NET Framework, therefore the (WinHttpHandler) test is expected to fail
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetFramework))]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_Redirect_CookiesArePreserved()
{
if (UseVersion == HttpVersion30)
Expand Down Expand Up @@ -528,6 +538,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async serverUrl =>

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_ReceiveSetCookieHeader_CookieUpdated()
{
const string newCookieValue = "789";
Expand Down Expand Up @@ -556,6 +567,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) =>

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_ReceiveSetCookieHeader_CookieRemoved()
{
await LoopbackServerFactory.CreateServerAsync(async (server, url) =>
Expand All @@ -580,6 +592,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) =>

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_ReceiveInvalidSetCookieHeader_ValidCookiesAdded()
{
await LoopbackServerFactory.CreateServerAsync(async (server, url) =>
Expand Down Expand Up @@ -615,6 +628,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, url) =>

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsyncWithRedirect_ReceiveSetCookie_CookieSent()
{
if (UseVersion == HttpVersion30)
Expand Down Expand Up @@ -675,6 +689,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async url =>

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsyncWithBasicAuth_ReceiveSetCookie_CookieSent()
{
if (UseVersion == HttpVersion30)
Expand Down Expand Up @@ -801,6 +816,7 @@ public HttpClientHandlerTest_Cookies_Http11(ITestOutputHelper output) : base(out

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "CookieContainer is not supported on Wasi")]
public async Task GetAsync_ReceiveMultipleSetCookieHeaders_CookieAdded()
{
await LoopbackServer.CreateServerAsync(async (server, url) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static IEnumerable<object[]> DecompressedResponse_MethodSpecified_Decompr
[Theory]
[MemberData(nameof(DecompressedResponse_MethodSpecified_DecompressedContentReturned_MemberData))]
[SkipOnPlatform(TestPlatforms.Browser, "AutomaticDecompression not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "AutomaticDecompression not supported on Wasi")]
public async Task DecompressedResponse_MethodSpecified_DecompressedContentReturned(string compressionName, bool all, bool useCopyTo, int contentLength)
{
if (IsWinHttpHandler &&
Expand Down Expand Up @@ -140,6 +141,7 @@ public static IEnumerable<object[]> DecompressedResponse_MethodNotSpecified_Orig
[Theory]
[MemberData(nameof(DecompressedResponse_MethodNotSpecified_OriginalContentReturned_MemberData))]
[SkipOnPlatform(TestPlatforms.Browser, "AutomaticDecompression not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "AutomaticDecompression not supported on Wasi")]
public async Task DecompressedResponse_MethodNotSpecified_OriginalContentReturned(
string encodingName, Func<Stream, Stream> compress, DecompressionMethods methods, bool useCopyTo)
{
Expand Down Expand Up @@ -179,6 +181,7 @@ await server.AcceptConnectionAsync(async connection =>
[InlineData("br", DecompressionMethods.Brotli)]
#endif
[SkipOnPlatform(TestPlatforms.Browser, "AutomaticDecompression not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "AutomaticDecompression not supported on Wasi")]
public async Task DecompressedResponse_EmptyBody_Success(string encodingName, DecompressionMethods methods)
{
await LoopbackServer.CreateClientAndServerAsync(async uri =>
Expand Down Expand Up @@ -270,6 +273,7 @@ await LoopbackServer.CreateServerAsync(async (server, url) =>
[InlineData(DecompressionMethods.GZip | DecompressionMethods.Deflate, "gzip; q=1.0, deflate; q=1.0", "")]
[InlineData(DecompressionMethods.GZip | DecompressionMethods.Deflate, "gzip; q=1.0", "deflate")]
[SkipOnPlatform(TestPlatforms.Browser, "AutomaticDecompression not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "AutomaticDecompression not supported on Wasi")]
public async Task GetAsync_SetAutomaticDecompression_AcceptEncodingHeaderSentWithQualityWeightingsNoDuplicates(
DecompressionMethods methods,
string manualAcceptEncodingHeaderValues,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public HttpClientHandler_RemoteServerTest(ITestOutputHelper output) : base(outpu
[InlineData(false)]
[InlineData(true)]
[SkipOnPlatform(TestPlatforms.Browser, "UseProxy not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "UseProxy not supported on Wasi")]
public async Task UseDefaultCredentials_SetToFalseAndServerNeedsAuth_StatusCodeUnauthorized(bool useProxy)
{
HttpClientHandler handler = CreateHttpClientHandler();
Expand Down Expand Up @@ -131,6 +132,7 @@ public async Task GetAsync_ResponseContentAfterClientAndHandlerDispose_Success(C
[OuterLoop("Uses external servers")]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[SkipOnPlatform(TestPlatforms.Browser, "Credentials is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "Credentials is not supported on Wasi")]
public async Task GetAsync_ServerNeedsBasicAuthAndSetDefaultCredentials_StatusCodeUnauthorized(Configuration.Http.RemoteServer remoteServer)
{
HttpClientHandler handler = CreateHttpClientHandler();
Expand All @@ -148,6 +150,7 @@ public async Task GetAsync_ServerNeedsBasicAuthAndSetDefaultCredentials_StatusCo
[OuterLoop("Uses external servers")]
[Theory, MemberData(nameof(RemoteServersMemberData))]
[SkipOnPlatform(TestPlatforms.Browser, "Credentials is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "Credentials is not supported on Wasi")]
public async Task GetAsync_ServerNeedsAuthAndSetCredential_StatusCodeOK(Configuration.Http.RemoteServer remoteServer)
{
HttpClientHandler handler = CreateHttpClientHandler();
Expand Down Expand Up @@ -611,6 +614,7 @@ public static IEnumerable<object[]> ExpectContinueVersion()
[Theory]
[MemberData(nameof(ExpectContinueVersion))]
[SkipOnPlatform(TestPlatforms.Browser, "ExpectContinue not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "ExpectContinue not supported on Wasi")]
public async Task PostAsync_ExpectContinue_Success(bool? expectContinue, Version version)
{
// Sync API supported only up to HTTP/1.1
Expand Down Expand Up @@ -1052,6 +1056,7 @@ public async Task GetAsync_AllowAutoRedirectTrue_RedirectToUriWithParams_Request
[InlineData(3, 3)]
[InlineData(3, 4)]
[SkipOnPlatform(TestPlatforms.Browser, "MaxConnectionsPerServer not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "MaxConnectionsPerServer not supported on Wasi")]
public async Task GetAsync_MaxAutomaticRedirectionsNServerHops_ThrowsIfTooMany(int maxHops, int hops)
{
if (IsWinHttpHandler && !PlatformDetection.IsWindows10Version1703OrGreater)
Expand Down Expand Up @@ -1122,6 +1127,7 @@ public async Task GetAsync_AllowAutoRedirectTrue_RedirectWithRelativeLocation(Co
[Theory, MemberData(nameof(RemoteServersMemberData))]
[OuterLoop("Uses external servers")]
[SkipOnPlatform(TestPlatforms.Browser, "Credentials is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "Credentials is not supported on Wasi")]
public async Task GetAsync_CredentialIsNetworkCredentialUriRedirect_StatusCodeUnauthorized(Configuration.Http.RemoteServer remoteServer)
{
HttpClientHandler handler = CreateHttpClientHandler();
Expand All @@ -1142,6 +1148,7 @@ public async Task GetAsync_CredentialIsNetworkCredentialUriRedirect_StatusCodeUn
[Theory, MemberData(nameof(RemoteServersMemberData))]
[OuterLoop("Uses external servers")]
[SkipOnPlatform(TestPlatforms.Browser, "Credentials is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "Credentials is not supported on Wasi")]
public async Task HttpClientHandler_CredentialIsNotCredentialCacheAfterRedirect_StatusCodeOK(Configuration.Http.RemoteServer remoteServer)
{
HttpClientHandler handler = CreateHttpClientHandler();
Expand Down Expand Up @@ -1169,6 +1176,7 @@ public async Task HttpClientHandler_CredentialIsNotCredentialCacheAfterRedirect_
[OuterLoop("Uses external servers")]
[Theory, MemberData(nameof(RemoteServersAndRedirectStatusCodes))]
[SkipOnPlatform(TestPlatforms.Browser, "Credentials is not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "Credentials is not supported on Wasi")]
public async Task GetAsync_CredentialIsCredentialCacheUriRedirect_StatusCodeOK(Configuration.Http.RemoteServer remoteServer, int statusCode)
{
if (statusCode == 308 && (IsWinHttpHandler && PlatformDetection.WindowsVersion < 10))
Expand Down Expand Up @@ -1242,6 +1250,7 @@ public static IEnumerable<object[]> RemoteServersAndCompressionUris()

[OuterLoop("Uses external servers")]
[SkipOnPlatform(TestPlatforms.Browser, "AutomaticDecompression not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "AutomaticDecompression not supported on Wasi")]
[Theory, MemberData(nameof(RemoteServersAndCompressionUris))]
public async Task GetAsync_SetAutomaticDecompression_ContentDecompressed_GZip(Configuration.Http.RemoteServer remoteServer, Uri uri)
{
Expand Down Expand Up @@ -1274,6 +1283,7 @@ public async Task GetAsync_SetAutomaticDecompression_ContentDecompressed_GZip(Co
[InlineData("http://httpbin.org/deflate", "\"deflated\": true")]
[InlineData("https://httpbin.org/deflate", "\"deflated\": true")]
[SkipOnPlatform(TestPlatforms.Browser, "AutomaticDecompression not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "AutomaticDecompression not supported on Wasi")]
public async Task GetAsync_SetAutomaticDecompression_ContentDecompressed_Deflate(string uri, string expectedContent)
{
if (IsWinHttpHandler)
Expand Down Expand Up @@ -1308,6 +1318,7 @@ public async Task GetAsync_SetAutomaticDecompression_ContentDecompressed_Deflate
[OuterLoop("Uses external servers")]
[Theory, MemberData(nameof(RemoteServersAndCompressionUris))]
[SkipOnPlatform(TestPlatforms.Browser, "AutomaticDecompression not supported on Browser")]
[SkipOnPlatform(TestPlatforms.Wasi, "AutomaticDecompression not supported on Wasi")]
public async Task GetAsync_SetAutomaticDecompression_HeadersRemoved(Configuration.Http.RemoteServer remoteServer, Uri uri)
{
// Sync API supported only up to HTTP/1.1
Expand Down
Loading

0 comments on commit 0d55a95

Please sign in to comment.