@hom3chuk/tektek
Version:
A library for detecting technologies used within HTTP Archive (HAR)
46 lines (45 loc) • 1.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var index_js_1 = require("../../common/index.js");
var detectExample = function (har, asap) {
if (asap === void 0) { asap = true; }
var res = {
detected: false,
name: 'Example Detector',
reasons: [],
};
// detects if ANY resource on the page is served with nginx
if ((0, index_js_1.anyResourceHeaderEquals)(har, 'server', 'nginx')) {
res.detected = true;
res.reasons.push('has server header');
if (asap) {
return res;
}
}
// detects if ANY resource on the page mentions Heroku
if ((0, index_js_1.anyResourceAnyHeadersContain)(har, 'heroku')) {
res.detected = true;
res.reasons.push('header mentions heroku');
if (asap) {
return res;
}
}
// detects if ROOT (ie the html page itself) is gzipped on transfer
if ((0, index_js_1.rootHeaderEquals)(har, 'content-encoding', 'gzip')) {
res.detected = true;
res.reasons.push('page has gzip header');
if (asap) {
return res;
}
}
// detects if ROOT (ie the html page itself) is served with Apache
if ((0, index_js_1.rootHeaderContains)(har, 'server', 'apache')) {
res.detected = true;
res.reasons.push('header mentions apache');
if (asap) {
return res;
}
}
return res;
};
exports.default = detectExample;