-
Notifications
You must be signed in to change notification settings - Fork 152
Add a TextResponse to easily return plain text HTTP responses #77
Conversation
## Text Responses | ||
|
||
`Zend\Diactoros\Response\TextResponse` allows creating a plain text response. It sets the | ||
`Content-Type` header to `text/html` by default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text/plain, not text/html.
Thanks @akrabat I've updated the commit. |
Yes, please. :) |
Looks good; I'll wait for your feedback as to whether or not you want to add charset to this PR as well before merging, however. |
Will do tomorrow! I'll add it on HtmlResponse too. UTF-8 by default? |
Awesome!
Of course! |
I've pushed a new commit setting UTF-8 for HTML and text responses (new commit as I think this is a separate change since it also applies to HtmlResponse). From what I have read online (example: http://stackoverflow.com/a/19815111/245552) JSON is UTF-8 (mandatory) so there is no need for a charset. |
Merged to develop for release with 1.2.0. Thanks, @mnapoli ! |
Fixes #76
I did not add a charset as the HtmlResponse didn't have one. Maybe this is something to add? (see e.g. in symfony). I am very far from an expert in HTTP stuff, so I'm just bringing it up but I have no idea (and it should probably be done in a separate PR anyway).