Skip to content

Commit d853e05

Browse files
committed
add Content-Length header to response
When bundle is large, I download the script using XMLHttpRequest, so that the download progress can be monitored. During development, to test that this works requires that Content-Length header be sent in the dev server.
1 parent 0901030 commit d853e05

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

middleware.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ module.exports = function(compiler, options) {
150150
var content = fs.readFileSync(filename);
151151
res.setHeader("Access-Control-Allow-Origin", "*"); // To support XHR, etc.
152152
res.setHeader("Content-Type", mime.lookup(filename));
153+
res.setHeader("Content-Length", content.length);
153154
if(options.headers) {
154155
for(var name in options.headers) {
155156
res.setHeader(name, options.headers[name]);

0 commit comments

Comments
 (0)