Skip to content
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

Is a text/plain formatter really included? #10103

Closed
jfoshee opened this issue Dec 24, 2018 — with docs.microsoft.com · 7 comments · Fixed by #14267
Closed

Is a text/plain formatter really included? #10103

jfoshee opened this issue Dec 24, 2018 — with docs.microsoft.com · 7 comments · Fixed by #14267
Assignees
Labels
Pri2 Priority 2 Source - Docs.ms Docs Customer feedback via GitHub Issue
Milestone

Comments

Copy link
Contributor

jfoshee commented Dec 24, 2018

I believe the current documentation is misleading:

> Use a custom formatter when you want the content negotiation process to support a content type that isn't supported by the built-in formatters (JSON, XML, and plain text).

The TextInputFormatter is abstract and does not add text/plain as a supported media type. If there is a concrete derived class for plain text please document it here, and update the docs: <https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.formatters.textinputformatter?view=aspnetcore-2.1>

As a result, it seems that one does in fact need to add a custom input formatter for plain text. See the TextPlainInputFormatter in this Stack Overflow response: <https://stackoverflow.com/a/41798960/483776>


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@dotnet-bot dotnet-bot added the Source - Docs.ms Docs Customer feedback via GitHub Issue label Dec 24, 2018
@Rick-Anderson
Copy link
Contributor

@tdykstra @scottaddie please confirm.

@Rick-Anderson Rick-Anderson added the Pri2 Priority 2 label Dec 24, 2018
@Rick-Anderson Rick-Anderson added this to the Backlog milestone Dec 24, 2018
@Rick-Anderson
Copy link
Contributor

Rick-Anderson commented Dec 24, 2018

@scottaddie @jfoshee , fixed in #10104

Copy link

kirodge commented Aug 16, 2019

The documentation was actually somewhat correct before.
If the client doesn't send an accept header, the default Outputformatter for simple strings is StringOutputFormatter which produces text/plain.
aspnet/Mvc#4945 (comment)

@Rick-Anderson Rick-Anderson reopened this Aug 16, 2019
@Rick-Anderson
Copy link
Contributor

Rick-Anderson commented Aug 16, 2019

@rynowak please review this issue and the changes made in https://github.com/aspnet/AspNetCore.Docs/pull/10104/files
@jfoshee please review

@rynowak
Copy link
Member

rynowak commented Aug 16, 2019

@kirodge is correct. We have StringOutputFormatter which will output strings as plain-text https://github.com/aspnet/AspNetCore/blob/master/src/Mvc/Mvc.Core/src/Formatters/StringOutputFormatter.cs#L14

Is this actually a feature request?

@rynowak
Copy link
Member

rynowak commented Aug 16, 2019

Oh, I see this is about input

@Rick-Anderson
Copy link
Contributor

@serpent5 This looks like an easy one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pri2 Priority 2 Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants