@glints/hapi-real-ip-plugin
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -1,2 +0,5 @@ | ||
export { default as RealIPPlugin, } from './RealIPPlugin'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var RealIPPlugin_1 = require("./RealIPPlugin"); | ||
exports.RealIPPlugin = RealIPPlugin_1.default; | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const RealIPPlugin = { | ||
@@ -21,3 +23,3 @@ name: 'RealIPPlugin', | ||
}; | ||
export default RealIPPlugin; | ||
exports.default = RealIPPlugin; | ||
//# sourceMappingURL=RealIPPlugin.js.map |
@@ -1,6 +0,8 @@ | ||
import 'mocha'; | ||
import { assert } from 'chai'; | ||
import * as Sinon from 'sinon'; | ||
import * as Hapi from '@hapi/hapi'; | ||
import RealIPPlugin from './RealIPPlugin'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("mocha"); | ||
const chai_1 = require("chai"); | ||
const Sinon = require("sinon"); | ||
const Hapi = require("@hapi/hapi"); | ||
const RealIPPlugin_1 = require("./RealIPPlugin"); | ||
describe('RealIPPlugin', () => { | ||
@@ -24,8 +26,8 @@ let server; | ||
it('should be registered', async () => { | ||
await server.register({ plugin: RealIPPlugin }); | ||
assert.exists(server.registrations[RealIPPlugin.name]); | ||
await server.register({ plugin: RealIPPlugin_1.default }); | ||
chai_1.assert.exists(server.registrations[RealIPPlugin_1.default.name]); | ||
}); | ||
describe('Plugin Functionality', () => { | ||
it('should pass address as-is without X-Forwarded-For header', async () => { | ||
await server.register({ plugin: RealIPPlugin }); | ||
await server.register({ plugin: RealIPPlugin_1.default }); | ||
await server.inject({ | ||
@@ -36,7 +38,7 @@ url: '/', | ||
const request = spy.args[0][0]; | ||
assert.strictEqual(request.info.remoteAddress, '1.2.3.4'); | ||
chai_1.assert.strictEqual(request.info.remoteAddress, '1.2.3.4'); | ||
}); | ||
it('should set request.info.remoteAddress with X-Forwarded-For header', async () => { | ||
await server.register({ | ||
plugin: RealIPPlugin, | ||
plugin: RealIPPlugin_1.default, | ||
options: { | ||
@@ -54,7 +56,7 @@ numProxies: 1, | ||
const request = spy.args[0][0]; | ||
assert.strictEqual(request.info.remoteAddress, '2.3.4.5'); | ||
chai_1.assert.strictEqual(request.info.remoteAddress, '2.3.4.5'); | ||
}); | ||
it('should handle multiple headers', async () => { | ||
await server.register({ | ||
plugin: RealIPPlugin, | ||
plugin: RealIPPlugin_1.default, | ||
options: { | ||
@@ -72,3 +74,3 @@ numProxies: 2, | ||
const request = spy.args[0][0]; | ||
assert.strictEqual(request.info.remoteAddress, '3.4.5.6'); | ||
chai_1.assert.strictEqual(request.info.remoteAddress, '3.4.5.6'); | ||
}); | ||
@@ -75,0 +77,0 @@ }); |
{ | ||
"name": "@glints/hapi-real-ip-plugin", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A plugin that attempts to determine the real IP of the client.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11031
109