Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Implement StreamOutputFormatter #1954

Closed
wants to merge 2 commits into from
Closed

Implement StreamOutputFormatter #1954

wants to merge 2 commits into from

Conversation

yishaigalatzer
Copy link
Contributor

Include Functional tests and unit tests

Resolves #1653

@ghost ghost added the cla-required label Feb 3, 2015
formatters,
ContentTypes);
}

var incomingAcceptHeaderMediaTypes = formatterContext.ActionContext.HttpContext.Request.GetTypedHeaders().Accept ??
Copy link
Member

Choose a reason for hiding this comment

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

What's the implication/purpose of this change? seems unrelated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes - It's unrelated, but not worth a separate PR. It was super unclear what happens when there is a single content, and lots of extra code was being executed. Since this is a scenario in this PR, I moved it up. Not extra tests needed

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the code now I see why you did the change. 👍 to clarity

@yishaigalatzer
Copy link
Contributor Author

updated

/// <inheritdoc />
public async Task WriteAsync([NotNull] OutputFormatterContext context)
{
using (var valueAsStream = ((Stream)context.Object))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we make this a Func<Stream>. This way we know we'll own the lifetime of the Stream and we wouldn't have to deal with streams being created but not disposed because the pipeline never got here..

Copy link
Member

Choose a reason for hiding this comment

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

you mean like a pushstreamcontent, but how would the usage be...like you mean we should have a streamresult or something which takes this func?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pranavkm is suggesting that if the method returns Func<Stream> the formatter will identify it as well. We discussed it earlier, and this could be a nice enhancement (in a separate PR/issue).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yishai Galatzer added 2 commits February 3, 2015 22:58
Include Functional tests and unit tests

Resolves #1653
@rynowak
Copy link
Member

rynowak commented Feb 4, 2015

:shipit: from me

@yishaigalatzer
Copy link
Contributor Author

Merged 5a3863d

@dougbu dougbu deleted the StreamFormatter branch July 15, 2018 03:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants