Adding TextPlainFormatter to always handle returning strings as text\pla...

One Functional test will be added after #849
That's the intended design. What does the base do?

-----Original Message-----
From: "Harsh Gupta" <notifications@github.com>
Sent: ‎7/‎28/‎2014 3:35 PM
To: "aspnet/Mvc" <Mvc@noreply.github.com>
Cc: "Yishai Galatzer" <yishai_galatzer@yahoo.com>
Subject: Re: [Mvc] Adding TextPlainFormatter to always handle returningstrings as text\pla... (#868)

In src/Microsoft.AspNet.Mvc.Core/Formatters/TextPlainFormatter.cs:
> +namespace Microsoft.AspNet.Mvc
> +{
> +    /// <summary>
> +    /// Writes a string value to the response.
> +    /// </summary>
> +    public class TextPlainFormatter : OutputFormatter
> +    {
> +        public TextPlainFormatter()
> +        {
> +            SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("text/plain"));
> +            SupportedEncodings.Add(Encoding.GetEncoding("utf-8"));
> +        }
> +        
> +        public override bool CanWriteResult(OutputFormatterContext context, MediaTypeHeaderValue contentType)
> +        {
> +            if (base.CanWriteResult(context, contentType))
well,not honoring the attribute does not sound good, however if the 99% scenario is it will be text/plain for a string (which I think it is) then this is fine.
—
Reply to this email directly or view it on GitHub.