Skip to content

Convert TestServer to pipes #11611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 27, 2019
Merged

Convert TestServer to pipes #11611

merged 3 commits into from
Jun 27, 2019

Conversation

Tratcher
Copy link
Member

@Tratcher Tratcher commented Jun 26, 2019

#11598 This makes response.BodyWriter a first class feature in TestServer rather than an adapter. There was already an internal pipe, but exposing it required a wrapper with added semantics such as FirstWrite for flushing headers.

@Tratcher Tratcher added this to the 3.0.0-preview7 milestone Jun 26, 2019
@Tratcher Tratcher self-assigned this Jun 26, 2019
@Tratcher Tratcher marked this pull request as ready for review June 26, 2019 22:23
@Tratcher Tratcher requested a review from analogrelay as a code owner June 26, 2019 22:23
private readonly ResponseBodyPipeWriter _responseWriter;
private readonly Func<bool> _allowSynchronousIO;

public ResponseBodyWriterStream(ResponseBodyPipeWriter responseWriter, Func<bool> allowSynchronousIO)
Copy link
Member

@halter73 halter73 Jun 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not have this ctor take the return value of responseWriter.AsStream() instead of copying all the AsStream() logic? Turning the ResponseBodyWriterStream into a decorator will probably be less fragile since any fixes/improvements to the PipeWriterStream will get picked up automatically.

Copy link
Member Author

@Tratcher Tratcher Jun 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe if there were anything novel in PipeWriterStream, but there isn't. I still have to override just as many Stream APIs. https://github.com/dotnet/corefx/blob/master/src/System.IO.Pipelines/src/System/IO/Pipelines/PipeWriterStream.cs

Justin was right, deriving from PipeWriterStream would have been the right thing if it were public.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make it public, file an issue though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tratcher Tratcher merged commit 1c0014c into master Jun 27, 2019
@ghost ghost deleted the tratcher/testbody branch June 27, 2019 23:16
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants