add response content-length
This commit is contained in:
parent
b0ff68e660
commit
b1b100ccf4
@ -18,6 +18,7 @@ export async function createResServer() {
|
|||||||
const resourcePath = path.join(dirPath, `${fileRealName}`);
|
const resourcePath = path.join(dirPath, `${fileRealName}`);
|
||||||
if (fs.existsSync(resourcePath)) {
|
if (fs.existsSync(resourcePath)) {
|
||||||
const data = fs.readFileSync(resourcePath);
|
const data = fs.readFileSync(resourcePath);
|
||||||
|
response.setHeader("content-length", data.length);
|
||||||
response.write(data);
|
response.write(data);
|
||||||
response.end();
|
response.end();
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user