@@ -119,13 +119,16 @@ public async Task ErrorPageWithoutAcceptHeaderForHtmlReturnsPlainText()
119
119
120
120
var responseText = await response . Content . ReadAsStringAsync ( ) ;
121
121
Assert . Equal ( "text/plain" , response . Content . Headers . ContentType . MediaType ) ;
122
+ Assert . Equal ( "utf-8" , response . Content . Headers . ContentType . CharSet ) ;
122
123
Assert . Contains ( "Test exception" , responseText ) ;
123
124
Assert . DoesNotContain ( "<html" , responseText ) ;
124
125
}
125
126
126
127
[ Fact ]
127
128
public async Task StatusCodeFromBadHttpRequestExceptionIsPreserved ( )
128
129
{
130
+ const int statusCode = 418 ;
131
+
129
132
// Arrange
130
133
using var host = new HostBuilder ( )
131
134
. ConfigureWebHost ( webHostBuilder =>
@@ -137,7 +140,7 @@ public async Task StatusCodeFromBadHttpRequestExceptionIsPreserved()
137
140
app . UseDeveloperExceptionPage ( ) ;
138
141
app . Run ( context =>
139
142
{
140
- throw new BadHttpRequestException ( "Not found!" , 404 ) ;
143
+ throw new BadHttpRequestException ( "Not found!" , statusCode ) ;
141
144
} ) ;
142
145
} ) ;
143
146
} ) . Build ( ) ;
@@ -150,7 +153,7 @@ public async Task StatusCodeFromBadHttpRequestExceptionIsPreserved()
150
153
var response = await server . CreateClient ( ) . GetAsync ( "/path" ) ;
151
154
152
155
// Assert
153
- Assert . Equal ( StatusCodes . Status404NotFound , ( int ) response . StatusCode ) ;
156
+ Assert . Equal ( statusCode , ( int ) response . StatusCode ) ;
154
157
155
158
var responseText = await response . Content . ReadAsStringAsync ( ) ;
156
159
Assert . Contains ( "Not found!" , responseText ) ;
0 commit comments