mirror of
https://github.com/sbrl/powahroot.git
synced 2025-02-08 06:34:56 +00:00
Sender: add ; charset=utf-8 for all plain text + html responses
This commit is contained in:
parent
49de8bf0dc
commit
4e2cd7e08f
2 changed files with 6 additions and 2 deletions
|
@ -15,6 +15,10 @@ npm install --save powahroot
|
|||
-----
|
||||
|
||||
|
||||
## v1.3.0 (unreleased)
|
||||
- Sender: Append `; charset=utf-8` to `content-type` when sending plain / html responses
|
||||
|
||||
|
||||
## v1.2.12
|
||||
- Update dependencies
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class Sender {
|
|||
* @return {void}
|
||||
*/
|
||||
html_string(status_code, html_string) {
|
||||
this.string(status_code, "text/html", html_string);
|
||||
this.string(status_code, "text/html; charset=utf-8", html_string);
|
||||
}
|
||||
/**
|
||||
* Sends a given thing of any type as a JSON response.
|
||||
|
@ -68,7 +68,7 @@ class Sender {
|
|||
*/
|
||||
plain(status_code, data) {
|
||||
this.response.writeHead(status_code, {
|
||||
"content-type": "text/plain",
|
||||
"content-type": "text/plain; charset=utf-8",
|
||||
"content-length": Buffer.byteLength(data, "utf8"),
|
||||
});
|
||||
this.response.end(data);
|
||||
|
|
Loading…
Reference in a new issue