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

Add a plaintext type that is safe by default #246

Open
empijei opened this issue Feb 8, 2021 · 3 comments
Open

Add a plaintext type that is safe by default #246

empijei opened this issue Feb 8, 2021 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@empijei
Copy link
Contributor

empijei commented Feb 8, 2021

It is currently possible to use the default dispatcher to write JSON, templated HTML and static HTML.

It would be beneficial to add one more type to allow text/plain strings to be written.

@mikue
Copy link
Collaborator

mikue commented Feb 8, 2021

Should this be done using a custom (safehttp/safehtml?) type, or can we just use string or even []byte (providing a similar experience to net/http), as long as we ensure the text/plain content-type header is enforced?

@kele
Copy link
Collaborator

kele commented Feb 8, 2021

A string is IMHO a good choice, especially since we know that they're UTF-8 encoded and we can set the charset properly.

@kele kele added enhancement New feature or request good first issue Good for newcomers labels Feb 11, 2021
@empijei
Copy link
Contributor Author

empijei commented Feb 15, 2021

+1 on using strings. If we enforce a safe content-type it should be fine to serve any string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants