public async Task ShouldSupportIgnoreHTTPSErrorsOption() { await using (var originalBrowser = await Puppeteer.LaunchAsync(TestConstants.DefaultBrowserOptions())) await using (var browser = await Puppeteer.ConnectAsync(new ConnectOptions { BrowserWSEndpoint = originalBrowser.WebSocketEndpoint, IgnoreHTTPSErrors = true })) await using (var page = await browser.NewPageAsync()) { var requestTask = HttpsServer.WaitForRequest( "/empty.html", request => request.HttpContext.Features.Get <ITlsHandshakeFeature>().Protocol); var responseTask = page.GoToAsync(TestConstants.HttpsPrefix + "/empty.html"); await Task.WhenAll( requestTask, responseTask); var response = responseTask.Result; Assert.True(response.Ok); Assert.NotNull(response.SecurityDetails); Assert.Equal( TestUtils.CurateProtocol(requestTask.Result.ToString()), TestUtils.CurateProtocol(response.SecurityDetails.Protocol)); } }
public async Task NetworkRedirectsShouldReportSecurityDetails() { var responses = new List <Response>(); HttpsServer.SetRedirect("/plzredirect", "/empty.html"); Page.Response += (_, e) => responses.Add(e.Response); var requestTask = HttpsServer.WaitForRequest( "/empty.html", request => request?.HttpContext?.Features?.Get <ITlsHandshakeFeature>()?.Protocol); var responseTask = Page.GoToAsync(TestConstants.HttpsPrefix + "/plzredirect"); await Task.WhenAll( requestTask, responseTask).WithTimeout(); var response = responseTask.Result; Assert.Equal(2, responses.Count); Assert.Equal(HttpStatusCode.Found, responses[0].Status); Assert.Equal( TestUtils.CurateProtocol(requestTask.Result.ToString()), TestUtils.CurateProtocol(response.SecurityDetails.Protocol)); }
public async Task ShouldWork() { var page = await NewPageAsync(new BrowserContextOptions { IgnoreHTTPSErrors = true }); var requestTask = HttpsServer.WaitForRequest( "/empty.html", request => request.HttpContext.Features.Get <ITlsHandshakeFeature>().Protocol); var responseTask = page.GoToAsync(TestConstants.HttpsPrefix + "/empty.html"); await Task.WhenAll( requestTask, responseTask); var response = responseTask.Result; Assert.Equal(HttpStatusCode.OK, response.Status); }
public async Task ShouldWork() { var requestTask = HttpsServer.WaitForRequest( "/empty.html", request => request?.HttpContext?.Features?.Get <ITlsHandshakeFeature>()?.Protocol); var responseTask = Page.GoToAsync(TestConstants.HttpsPrefix + "/empty.html"); await Task.WhenAll( requestTask, responseTask).WithTimeout(); var response = responseTask.Result; Assert.Equal(HttpStatusCode.OK, response.Status); Assert.NotNull(response.SecurityDetails); Assert.Equal( TestUtils.CurateProtocol(requestTask.Result.ToString()), TestUtils.CurateProtocol(response.SecurityDetails.Protocol)); }