Skip to content
Permalink
Browse files

Verify overriding postdata and method on navigation (#1093)

  • Loading branch information...
Meir017 authored and kblok committed May 1, 2019
1 parent 9444c9c commit 2b2f1d290f87350fe6fc7929605e499e3616d2b3
Showing with 18 additions and 0 deletions.
  1. +18 −0 lib/PuppeteerSharp.Tests/NetworkTests/RequestContinueTests.cs
@@ -114,5 +114,23 @@ public async Task ShouldAmendPostData()

Assert.Equal("doggo", await requestTask.Result);
}

[Fact]
public async Task ShouldAmendBothPostDataAndMethodOnNavigation()
{
await Page.SetRequestInterceptionAsync(true);
Page.Request += async (sender, e) => await e.Request.ContinueAsync(new Payload
{
Method = HttpMethod.Post,
PostData = "doggo"
});
var serverRequest = Server.WaitForRequest("/empty.html", req => new { req.Method, Body = new StreamReader(req.Body).ReadToEnd() });
await Task.WhenAll(
serverRequest,
Page.GoToAsync(TestConstants.EmptyPage)
);
Assert.Equal(HttpMethod.Post.Method, serverRequest.Result.Method);
Assert.Equal("doggo", serverRequest.Result.Body);
}
}
}

0 comments on commit 2b2f1d2

Please sign in to comment.
You can’t perform that action at this time.