Merge branch 'master' into dev
# Conflicts: # .github/workflows/ci.yml # src/lang/es-ES.json # src/lang/sl-SI.json # src/lib/constants.ts # src/lib/detect.ts # src/queries/sql/reports/getRevenue.ts
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as detect from '../detect';
|
||||
|
||||
const IP = '127.0.0.1';
|
||||
const BAD_IP = '127.127.127.127';
|
||||
|
||||
test('getIpAddress: Custom header', () => {
|
||||
process.env.CLIENT_IP_HEADER = 'x-custom-ip-header';
|
||||
@@ -16,6 +17,12 @@ test('getIpAddress: Standard header', () => {
|
||||
expect(detect.getIpAddress(new Headers({ 'x-forwarded-for': IP }))).toEqual(IP);
|
||||
});
|
||||
|
||||
test('getIpAddress: CloudFlare header is lower priority than standard header', () => {
|
||||
expect(
|
||||
detect.getIpAddress(new Headers({ 'cf-connecting-ip': BAD_IP, 'x-forwarded-for': IP })),
|
||||
).toEqual(IP);
|
||||
});
|
||||
|
||||
test('getIpAddress: No header', () => {
|
||||
expect(detect.getIpAddress(new Headers())).toEqual(null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user