Can't edit response headers in PreSendRequestHeaders stage if write a buffering disabled response
To Reproduce
// somewhere early
responseBodyFeature.DisableBuffering();
...
HttpApplication.ExecuteHandler((...)=>....)
// write a buffering disabled http response
HttpApplication.PreSendRequestHeaders((...) => response.AddHeader("a", ...); // it will throw here. In framework I still can change headers.
Exceptions (if any)
System.InvalidOperationException: 'The response headers cannot be modified because the response has already started.'
at Microsoft.AspNetCore.HttpSys.Internal.HeaderCollection.ThrowIfReadOnly()
at Microsoft.AspNetCore.HttpSys.Internal.HeaderCollection.set_Item(String key, StringValues value)
at Microsoft.AspNetCore.Http.ParsingHelpers.AppendHeaderUnmodified(IHeaderDictionary headers, String key, StringValues values)
at System.Web.HttpResponse.AppendHeader(String name, String value) in System.Web\HttpResponse.cs:line 269
at System.Web.HttpResponse.AddHeader(String name, String value) in System.Web\HttpResponse.cs:line 264
......
Describe the bug
Can't edit response headers in
PreSendRequestHeaders
stage if write a buffering disabled responseTo Reproduce
Exceptions (if any)
Further technical details
I am testing 2.0.0-preview1.24405.2.