UNPKG

@hom3chuk/tektek

Version:

A library for detecting technologies used within HTTP Archive (HAR)

47 lines (46 loc) 1.38 kB
import { anyResourceAnyHeadersContain, anyResourceHeaderContains, anyResourceHeaderExists } from "../../common/index.js"; var detectHAProxy = function (har, asap) { if (asap === void 0) { asap = true; } var res = { detected: false, name: 'HAProxy', reasons: [], }; if (anyResourceHeaderExists(har, 'x-haproxy')) { res.detected = true; res.reasons.push('x-haproxy header exists'); if (asap) { return res; } } if (anyResourceHeaderContains(har, 'x-proxy', 'haproxy')) { res.detected = true; res.reasons.push('x-proxy header mentions haproxy'); if (asap) { return res; } } if (anyResourceHeaderExists(har, 'x-haproxy-info')) { res.detected = true; res.reasons.push('x-haproxy-info header exists'); if (asap) { return res; } } if (anyResourceHeaderExists(har, 'x-haproxy-server')) { res.detected = true; res.reasons.push('x-haproxy-server header exists'); if (asap) { return res; } } if (anyResourceAnyHeadersContain(har, 'haproxy-external')) { res.detected = true; res.reasons.push('aproxy-external mentioned'); if (asap) { return res; } } return res; }; export default detectHAProxy;