通过设置 response
的 Content-type
来解决
import type { IncomingMessage, ServerResponse } from 'http'
(req: IncomingMessage, res: ServerResponse) => {
// 省略 ...
res.setHeader('Content-type', 'application/json;charset=utf-8')
// 省略 ...
}
2022-09-17 07:18:04
通过设置 response
的 Content-type
来解决
import type { IncomingMessage, ServerResponse } from 'http'
(req: IncomingMessage, res: ServerResponse) => {
// 省略 ...
res.setHeader('Content-type', 'application/json;charset=utf-8')
// 省略 ...
}