Skip to content

Commit 029a4c0

Browse files
jkotalikanalogrelay
authored andcommitted
Update check for 413 in IIS (#14589)
1 parent db40877 commit 029a4c0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/MaxRequestBodySizeTests.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ public async Task SetIISLimitMaxRequestBodySizeE2EWorks()
4949

5050
var result = await deploymentResult.HttpClient.PostAsync("/ReadRequestBody", new StringContent("test"));
5151

52-
// IIS returns a 404 instead of a 413...
53-
Assert.Equal(HttpStatusCode.NotFound, result.StatusCode);
52+
// IIS either returns a 404 or a 413 based on versions of IIS.
53+
// Check for both as we don't know which specific patch version.
54+
Assert.True(result.StatusCode == HttpStatusCode.NotFound || result.StatusCode == HttpStatusCode.RequestEntityTooLarge);
5455
}
5556

5657
[ConditionalFact]
@@ -68,7 +69,8 @@ await connection.Send(
6869
"Host: localhost",
6970
"",
7071
"A");
71-
await connection.Receive("HTTP/1.1 404 Not Found");
72+
var requestLine = await connection.ReadLineAsync();
73+
Assert.True(requestLine.Contains("404") || requestLine.Contains("413"));
7274
}
7375
}
7476

0 commit comments

Comments
 (0)