File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -71,10 +71,11 @@ public PipeWriter Writer
7171 }
7272
7373 /// <summary>
74- /// Not supported .
74+ /// Opts out of write buffering for the response .
7575 /// </summary>
7676 public virtual void DisableBuffering ( )
7777 {
78+ PriorFeature ? . DisableBuffering ( ) ;
7879 }
7980
8081 /// <summary>
Original file line number Diff line number Diff line change @@ -41,6 +41,22 @@ public async Task CompleteAsyncWontCallsStartAsyncIfAlreadyStarted()
4141 //Assert
4242 Assert . Equal ( 1 , streamResponseBodyFeature . StartCalled ) ;
4343 }
44+
45+ [ Fact ]
46+ public void DisableBufferingCallsInnerFeature ( )
47+ {
48+ // Arrange
49+ var stream = new MemoryStream ( ) ;
50+
51+ var innerFeature = new InnerDisableBufferingFeature ( stream , null ) ;
52+ var streamResponseBodyFeature = new StreamResponseBodyFeature ( stream , innerFeature ) ;
53+
54+ // Act
55+ streamResponseBodyFeature . DisableBuffering ( ) ;
56+
57+ //Assert
58+ Assert . True ( innerFeature . DisableBufferingCalled ) ;
59+ }
4460 }
4561
4662 public class TestStreamResponseBodyFeature : StreamResponseBodyFeature
@@ -59,4 +75,19 @@ public override Task StartAsync(CancellationToken cancellationToken = default)
5975
6076 public int StartCalled { get ; private set ; }
6177 }
78+
79+ public class InnerDisableBufferingFeature : StreamResponseBodyFeature
80+ {
81+ public InnerDisableBufferingFeature ( Stream stream , IHttpResponseBodyFeature priorFeature )
82+ : base ( stream , priorFeature )
83+ {
84+ }
85+
86+ public override void DisableBuffering ( )
87+ {
88+ DisableBufferingCalled = true ;
89+ }
90+
91+ public bool DisableBufferingCalled { get ; set ; }
92+ }
6293}
You can’t perform that action at this time.
0 commit comments