Headers should only be set after file is written.
This commit is contained in:
parent
24a26953a7
commit
118e7928b9
|
@ -91,7 +91,6 @@ CachingMiddleware.prototype = new function () {
|
|||
res.setHeader(key, headers[key]);
|
||||
});
|
||||
headers = _headers;
|
||||
responseCache[cacheKey] = {statusCode: status, headers: headers};
|
||||
|
||||
old_res.write = res.write;
|
||||
old_res.end = res.end;
|
||||
|
@ -118,7 +117,10 @@ CachingMiddleware.prototype = new function () {
|
|||
}
|
||||
});
|
||||
}
|
||||
], respond);
|
||||
], function () {
|
||||
responseCache[cacheKey] = {statusCode: status, headers: headers};
|
||||
respond();
|
||||
});
|
||||
};
|
||||
} else if (status == 304) {
|
||||
// Nothing new changed from the cached version.
|
||||
|
|
Loading…
Reference in New Issue