chore: release SVR.JS Cache mod 1.1.1
This commit is contained in:
parent
8cd192a8e6
commit
e0b4274707
3 changed files with 8 additions and 8 deletions
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2018-2024 SVR.JS
|
Copyright (c) 2018-2025 SVR.JS
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"name": "SVR.JS Cache mod",
|
"name": "SVR.JS Cache mod",
|
||||||
"version": "1.1.0"
|
"version": "1.1.1"
|
||||||
}
|
}
|
||||||
|
|
12
src/index.js
12
src/index.js
|
@ -84,12 +84,12 @@ module.exports = function (req, res, logFacilities, config, next) {
|
||||||
|
|
||||||
res.setHeader = function (name, value) {
|
res.setHeader = function (name, value) {
|
||||||
writtenHeaders[name.toLowerCase()] = value;
|
writtenHeaders[name.toLowerCase()] = value;
|
||||||
originalSetHeader(name, value);
|
return originalSetHeader(name, value);
|
||||||
};
|
};
|
||||||
|
|
||||||
res.removeHeader = function (name) {
|
res.removeHeader = function (name) {
|
||||||
delete writtenHeaders[name.toLowerCase()];
|
delete writtenHeaders[name.toLowerCase()];
|
||||||
originalRemoveHeader(name);
|
return originalRemoveHeader(name);
|
||||||
};
|
};
|
||||||
|
|
||||||
res.writeHead = function (statusCode, statusCodeDescription, headers) {
|
res.writeHead = function (statusCode, statusCodeDescription, headers) {
|
||||||
|
@ -102,13 +102,13 @@ module.exports = function (req, res, logFacilities, config, next) {
|
||||||
writtenStatusCode = statusCode;
|
writtenStatusCode = statusCode;
|
||||||
originalSetHeader("X-SVRJS-Cache", "MISS");
|
originalSetHeader("X-SVRJS-Cache", "MISS");
|
||||||
if (headers || typeof statusCodeDescription !== "object") {
|
if (headers || typeof statusCodeDescription !== "object") {
|
||||||
originalWriteHead(
|
return originalWriteHead(
|
||||||
writtenStatusCode,
|
writtenStatusCode,
|
||||||
statusCodeDescription,
|
statusCodeDescription,
|
||||||
writtenHeaders
|
writtenHeaders
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
originalWriteHead(writtenStatusCode, writtenHeaders);
|
return originalWriteHead(writtenStatusCode, writtenHeaders);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ module.exports = function (req, res, logFacilities, config, next) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
originalEnd(chunk, encoding, callback);
|
return originalEnd(chunk, encoding, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (req.method != "HEAD") {
|
if (req.method != "HEAD") {
|
||||||
|
@ -220,7 +220,7 @@ module.exports = function (req, res, logFacilities, config, next) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
originalWrite(chunk, encoding, callback);
|
return originalWrite(chunk, encoding, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
res.on("pipe", (src) => {
|
res.on("pipe", (src) => {
|
||||||
|
|
Loading…
Reference in a new issue