Skip to content

Commit

Permalink
- Fix unit-tests to support req.get
Browse files Browse the repository at this point in the history
  • Loading branch information
eldarlandman committed Jan 11, 2024
1 parent 5b32446 commit ce35968
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/pxcors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ describe('PX Cors - pxCors.js', () => {
req.protocol = 'http';
req.ip = '1.2.3.4';
req.hostname = 'example.com';
req.host = 'example.com';
req.get = (key) => {
if (key === 'host') {
return req.host;
}
return req.headers[key] || '';
};

Expand Down
3 changes: 3 additions & 0 deletions test/pxenforcer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ describe('PX Enforcer - pxenforcer.js', () => {
req.ip = '1.2.3.4';
req.hostname = 'example.com';
req.get = (key) => {
if (key === 'host') {
return req.host;
}
return req.headers[key] || '';
};

Expand Down

0 comments on commit ce35968

Please sign in to comment.