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

Media handler for text/plain #2037

Open
vytas7 opened this issue Mar 12, 2022 · 3 comments · May be fixed by #2419
Open

Media handler for text/plain #2037

vytas7 opened this issue Mar 12, 2022 · 3 comments · May be fixed by #2419
Labels
documentation enhancement good first issue Comment on this issue if you'd like to volunteer to work on this. Thanks! needs contributor Comment on this issue if you'd like to volunteer to work on this. Thanks! proposal
Milestone

Comments

@vytas7
Copy link
Member

vytas7 commented Mar 12, 2022

As proposed by @maxking on Gitter:

I have been trying to add support for msgpack in Mailman's API (mailman/mailman!977) and in the process of doing that, I am trying to move off of doing the serialization in our code and setting the request.body/text to setting the response.media (in the actual resource) and response.content_type (before hand, in a middleware using request.accept) to let Falcon do the right thing. One thing I started noticing is that we were still returning some plain text and there is no default handler for text/plain response (presumably because it can be done with response.text or something). I was wondering if y'all would be open to adding a handler for text/plain, which basically works like identity?

@vytas7
Copy link
Member Author

vytas7 commented Mar 12, 2022

I've sketched a prototype how this could look like: https://gist.github.com/vytas7/7224c6d552c6e01992dfd84c01a40063.

Most probably, we won't be willing to enable such a handler by default in the first incarnation (because that would be a breaking change for req handlers; debatable for resp handlers). We could either add an optional handler that is not installed by default (like MessagePackHandler), or morph my gist into a docs recipe.

@maxking
Copy link
Contributor

maxking commented Mar 12, 2022

While both Docs and a handler not enabled by default would do the job, if there is any interest in supporting the text/plain handler in the long term, perhaps adding it as handler would enable more usage for it.

Although, if we aren't sure about how the handler should work for different charsets or its design (i.e. can be breaking change over next few releases) then we can add it as a docs recipe until we finalize the design of it.

@vytas7
Copy link
Member Author

vytas7 commented Oct 7, 2024

Let's start with a recipe.

Note that recipes now need to be covered with unit tests as well.

@vytas7 vytas7 added good first issue Comment on this issue if you'd like to volunteer to work on this. Thanks! needs contributor Comment on this issue if you'd like to volunteer to work on this. Thanks! and removed needs-decision labels Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation enhancement good first issue Comment on this issue if you'd like to volunteer to work on this. Thanks! needs contributor Comment on this issue if you'd like to volunteer to work on this. Thanks! proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants