33
44using System . Globalization ;
55using System . Net . Http ;
6- using System . Net . Http . Headers ;
76using System . Text ;
87using System . Text . RegularExpressions ;
98using Components . TestServer . RazorComponents ;
109using Microsoft . AspNetCore . Components . E2ETest . Infrastructure ;
1110using Microsoft . AspNetCore . Components . E2ETest . Infrastructure . ServerFixtures ;
1211using Microsoft . AspNetCore . E2ETesting ;
12+ using Microsoft . Net . Http . Headers ;
1313using OpenQA . Selenium ;
1414using TestServer ;
1515using Xunit . Abstractions ;
@@ -30,13 +30,29 @@ public override Task InitializeAsync()
3030 => InitializeAsync ( BrowserFixture . StreamingContext ) ;
3131
3232 [ Fact ]
33- public void CanRenderNonstreamingPageWithoutInjectingStreamingMarkers ( )
33+ public async Task CanRenderNonstreamingPageWithoutInjectingStreamingMarkersOrHeaders ( )
3434 {
3535 Navigate ( ServerPathBase ) ;
3636
3737 Browser . Equal ( "Hello" , ( ) => Browser . Exists ( By . TagName ( "h1" ) ) . Text ) ;
3838
3939 Assert . DoesNotContain ( "<blazor-ssr" , Browser . PageSource ) ;
40+
41+ using var httpClient = new HttpClient ( ) ;
42+ using var response = await httpClient . GetAsync ( new Uri ( _serverFixture . RootUri , ServerPathBase ) ) ;
43+ response . EnsureSuccessStatusCode ( ) ;
44+
45+ Assert . False ( response . Content . Headers . Contains ( HeaderNames . ContentEncoding ) ) ;
46+ }
47+
48+ [ Fact ]
49+ public async Task DoesRenderStreamingPageWithStreamingHeadersToDisableBuffering ( )
50+ {
51+ using var httpClient = new HttpClient ( ) ;
52+ using var response = await httpClient . GetAsync ( new Uri ( _serverFixture . RootUri , $ "{ ServerPathBase } /streaming") , HttpCompletionOption . ResponseHeadersRead ) ;
53+ response . EnsureSuccessStatusCode ( ) ;
54+
55+ Assert . Equal ( "identity" , response . Content . Headers . ContentEncoding . Single ( ) ) ;
4056 }
4157
4258 [ Theory ]
0 commit comments