#1253 TestServer: mark response headers IsReadOnly on start
This commit is contained in:
parent
65bad5b9ab
commit
1e556e0b46
|
|
@ -13,10 +13,11 @@ namespace Microsoft.AspNetCore.TestHost
|
|||
{
|
||||
private Func<Task> _responseStartingAsync = () => Task.FromResult(true);
|
||||
private Func<Task> _responseCompletedAsync = () => Task.FromResult(true);
|
||||
private HeaderDictionary _headers = new HeaderDictionary();
|
||||
|
||||
public ResponseFeature()
|
||||
{
|
||||
Headers = new HeaderDictionary();
|
||||
Headers = _headers;
|
||||
Body = new MemoryStream();
|
||||
|
||||
// 200 is the default status code all the way down to the host, so we set it
|
||||
|
|
@ -69,6 +70,7 @@ namespace Microsoft.AspNetCore.TestHost
|
|||
{
|
||||
await _responseStartingAsync();
|
||||
HasStarted = true;
|
||||
_headers.IsReadOnly = true;
|
||||
}
|
||||
|
||||
public Task FireOnResponseCompletedAsync()
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ namespace Microsoft.AspNetCore.TestHost
|
|||
await responseInformation.FireOnSendingHeadersAsync();
|
||||
|
||||
Assert.True(responseInformation.HasStarted);
|
||||
Assert.True(responseInformation.Headers.IsReadOnly);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Reference in New Issue