File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
PuppeteerSharp.Tests/NetworkTests Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -91,5 +91,28 @@ await Page.EvaluateFunctionAsync(@"PREFIX =>
9191 var img = await Page . QuerySelectorAsync ( "img" ) ;
9292 Assert . True ( ScreenshotHelper . PixelMatch ( "mock-binary-response.png" , await img . ScreenshotDataAsync ( ) ) ) ;
9393 }
94+
95+ [ Fact ]
96+ public async Task ShouldStringifyInterceptedRequestResponseHeaders ( )
97+ {
98+ await Page . SetRequestInterceptionAsync ( true ) ;
99+ Page . Request += async ( sender , e ) =>
100+ {
101+ await e . Request . RespondAsync ( new ResponseData
102+ {
103+ Status = HttpStatusCode . OK ,
104+ Headers = new Dictionary < string , object >
105+ {
106+ [ "foo" ] = true
107+ } ,
108+ Body = "Yo, page!"
109+ } ) ;
110+ } ;
111+
112+ var response = await Page . GoToAsync ( TestConstants . EmptyPage ) ;
113+ Assert . Equal ( HttpStatusCode . OK , response . Status ) ;
114+ Assert . Equal ( "True" , response . Headers [ "foo" ] ) ;
115+ Assert . Equal ( "Yo, page!" , await Page . EvaluateExpressionAsync < string > ( "document.body.textContent" ) ) ;
116+ }
94117 }
95118}
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public string Body
2525 /// <value>The body as binary.</value>
2626 public byte [ ] BodyData { get ; set ; }
2727 /// <summary>
28- /// Response headers.
28+ /// Response headers. Header values will be converted to a string.
2929 /// </summary>
3030 /// <value>Headers.</value>
3131 public Dictionary < string , object > Headers { get ; set ; }
You can’t perform that action at this time.
0 commit comments