send proper content-length
This commit is contained in:
parent
431aeda80b
commit
aa4629853f
|
@ -159,10 +159,10 @@ export default class Router {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mime.startsWith("video") && !mime.startsWith("audio")) {
|
if(!mime.startsWith("video") && !mime.startsWith("audio")) {
|
||||||
res.reply({
|
res.writeHead(200, {
|
||||||
type: this.#mimes.get(filename.split(".").pop()).toLowerCase(),
|
"Content-Length": stat.size,
|
||||||
body: fs.readFileSync(path.join(dir, filename))
|
"Content-Type": this.#mimes.get(filename.split(".").pop()).toLowerCase()
|
||||||
});
|
}).end(fs.readFileSync(path.join(dir, filename)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user