diff --git a/lib/PuppeteerSharp.Tests/PageTests/SetRequestInterceptionTests.cs b/lib/PuppeteerSharp.Tests/PageTests/SetRequestInterceptionTests.cs index ce0ec5ec1..27db135d6 100644 --- a/lib/PuppeteerSharp.Tests/PageTests/SetRequestInterceptionTests.cs +++ b/lib/PuppeteerSharp.Tests/PageTests/SetRequestInterceptionTests.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http; using System; using System.Collections.Generic; using System.IO; @@ -41,7 +41,7 @@ public async Task ShouldIntercept() Assert.Equal(TestConstants.Port, response.RemoteAddress.Port); } - [Fact(Skip = "Ignored on Puppeteer")] + [Fact] public async Task ShouldWorkWhenPostIsEedirectedWith302() { Server.SetRedirect("/rredirect", "/empty.html"); diff --git a/lib/PuppeteerSharp/Payload.cs b/lib/PuppeteerSharp/Payload.cs index 47b63e401..d2b9e3575 100644 --- a/lib/PuppeteerSharp/Payload.cs +++ b/lib/PuppeteerSharp/Payload.cs @@ -14,6 +14,16 @@ namespace PuppeteerSharp /// public class Payload { + private static readonly ISet IgnoredHeaders = new HashSet(StringComparer.OrdinalIgnoreCase) + { + "accept", + "referer", + "x-devtools-emulate-network-conditions-client-id", + "cookie", + "origin", + "content-type" + }; + /// /// Gets or sets the HTTP method. /// @@ -64,12 +74,7 @@ internal string Hash { foreach (var item in Headers.OrderBy(kv => kv.Key)) { - bool HeaderEquals(string name) => item.Key.Equals(name, StringComparison.OrdinalIgnoreCase); - - if (HeaderEquals("accept") - || HeaderEquals("referer") - || HeaderEquals("x-devtools-emulate-network-conditions-client-id") - || HeaderEquals("cookie")) + if (IgnoredHeaders.Contains(item.Key)) { continue; }