upload site
This commit is contained in:
commit
69c5b90d6a
3300 changed files with 224783 additions and 0 deletions
29
node_modules/expect-ct/dist/index.js
generated
vendored
Normal file
29
node_modules/expect-ct/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
function parseMaxAge(option) {
|
||||
if (option === undefined) {
|
||||
return 0;
|
||||
}
|
||||
if (typeof option !== 'number' || option < 0) {
|
||||
throw new Error(option + " is not a valid value for maxAge. Please choose a positive integer.");
|
||||
}
|
||||
return option;
|
||||
}
|
||||
function getHeaderValueFromOptions(options) {
|
||||
options = options || {};
|
||||
var directives = [];
|
||||
if (options.enforce) {
|
||||
directives.push('enforce');
|
||||
}
|
||||
directives.push("max-age=" + parseMaxAge(options.maxAge));
|
||||
if (options.reportUri) {
|
||||
directives.push("report-uri=\"" + options.reportUri + "\"");
|
||||
}
|
||||
return directives.join(', ');
|
||||
}
|
||||
module.exports = function expectCt(options) {
|
||||
var headerValue = getHeaderValueFromOptions(options);
|
||||
return function expectCt(_req, res, next) {
|
||||
res.setHeader('Expect-CT', headerValue);
|
||||
next();
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue