Only check for direct properties from the headers object

This commit is contained in:
Faisal Salman
2025-08-26 22:29:08 +07:00
parent 3e65196b57
commit fb1ed5cf6b
2 changed files with 9 additions and 1 deletions

View File

@@ -389,4 +389,10 @@ describe('Read user-agent data from req.headers', function () {
const { browser } = UAParser(hEaDeRs);
assert.strictEqual(browser.toString(), "Midori 0.2.2");
});
it('Empty headers should not raise any error', function () {
const emptyHeaders = {};
const { browser } = UAParser(emptyHeaders);
assert.strictEqual(browser.toString(), "undefined");
});
});