File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
lib/PuppeteerSharp.Tests/NetworkTests Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,26 @@ public async Task ShouldWorkWhenHeaderManipulationHeadersWithRedirect()
8282 await Page . GoToAsync ( TestConstants . ServerUrl + "/rrredirect" ) ;
8383 }
8484
85+ [ Fact ]
86+ public async Task ShouldBeAbleToRemoveHeaders ( )
87+ {
88+ await Page . SetRequestInterceptionAsync ( true ) ;
89+ Page . Request += async ( sender , e ) =>
90+ {
91+ var headers = e . Request . Headers . Clone ( ) ;
92+ headers [ "foo" ] = "bar" ;
93+ headers . Remove ( "origin" ) ;
94+ await e . Request . ContinueAsync ( new Payload { Headers = headers } ) ;
95+ } ;
96+
97+ var requestTask = Server . WaitForRequest ( "/empty.html" , request => request . Headers [ "origin" ] ) ;
98+ await Task . WhenAll (
99+ requestTask ,
100+ Page . GoToAsync ( TestConstants . ServerUrl + "/empty.html" )
101+ ) ;
102+ Assert . True ( string . IsNullOrEmpty ( requestTask . Result ) ) ;
103+ }
104+
85105 [ Fact ]
86106 public async Task ShouldContainRefererHeader ( )
87107 {
You can’t perform that action at this time.
0 commit comments