Skip to content

Commit

Permalink
Relax request matching heuristic (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meir017 authored and kblok committed Feb 2, 2019
1 parent e764317 commit ff53a36
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -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");
Expand Down
17 changes: 11 additions & 6 deletions lib/PuppeteerSharp/Payload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ namespace PuppeteerSharp
/// </summary>
public class Payload
{
private static readonly ISet<string> IgnoredHeaders = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"accept",
"referer",
"x-devtools-emulate-network-conditions-client-id",
"cookie",
"origin",
"content-type"
};

/// <summary>
/// Gets or sets the HTTP method.
/// </summary>
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit ff53a36

Please sign in to comment.