Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Need convenience API to write strings & buffered response to body #66

Closed
yishaigalatzer opened this issue May 29, 2014 · 3 comments
Closed

Comments

@yishaigalatzer
Copy link
Contributor

Right now when trying to write strings to the output, there is lots of user code required to account for computing content-length, dealing with encoding etc.

The responsibility for this shouldn't be in MVC or user code, as its very error prone and repetitive code.

I realize this might belong in a helper library and not in abstractions, but we don't have that library anywhere I'm aware of.

@Tratcher
Copy link
Member

Such a helper would write the entire response in one call, and would have to set:
Content-Length
Content-Type with charset (assume utf8?)

SendResponse(string body, Encoding enc, string contentType)

@yishaigalatzer
Copy link
Contributor Author

assume utf-8 without BOM?

@glennc glennc added this to the 1.0.0-alpha3 milestone Jun 23, 2014
@glennc
Copy link
Member

glennc commented Jun 23, 2014

SIgnalR needs the same method.

We should have Microsoft.AspNet.HttpExtensions with:
End(byte[] body, string contentType = "text/plain")
Plus all the other overloads.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants