-
-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
lib/PuppeteerSharp.Tests/NetworkTests/RequestHeadersTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace PuppeteerSharp.Tests.NetworkTests | ||
{ | ||
[Collection("PuppeteerLoaderFixture collection")] | ||
public class RequestHeadersTests : PuppeteerPageBaseTest | ||
{ | ||
public RequestHeadersTests(ITestOutputHelper output) : base(output) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task ShouldWork() | ||
{ | ||
var response = await Page.GoToAsync(TestConstants.EmptyPage); | ||
Assert.Contains("Chrome", response.Request.Headers["User-Agent"]); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
lib/PuppeteerSharp.Tests/NetworkTests/ResponseHeadersTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace PuppeteerSharp.Tests.NetworkTests | ||
{ | ||
[Collection("PuppeteerLoaderFixture collection")] | ||
public class ResponseHeadersTests : PuppeteerPageBaseTest | ||
{ | ||
public ResponseHeadersTests(ITestOutputHelper output) : base(output) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task ShouldWork() | ||
{ | ||
Server.SetRoute("/empty.html", (context) => | ||
{ | ||
context.Response.Headers["foo"] = "bar"; | ||
return Task.CompletedTask; | ||
}); | ||
|
||
var response = await Page.GoToAsync(TestConstants.EmptyPage); | ||
Assert.Contains("bar", response.Headers["foo"]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters