Skip to content

Commit

Permalink
Merge pull request #1 from ericjohney/hapi-v19
Browse files Browse the repository at this point in the history
update to support hapi v19
  • Loading branch information
rajivm authored Feb 19, 2020
2 parents 5842ebe + 854fdbd commit c1d4b2f
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 220 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.9.1
12.16.1
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
language: node_js
node_js:
- "8"
- "12"
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports.register = (server, options) => {
method: (request, h) => {
let remoteAddress = Forwarded(request.raw.req).pop().trim();
if (remoteAddress) {
request.info.remoteAddress = remoteAddress;
request.info._remoteAddress = remoteAddress;
}
return h.continue;
}
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hapi-forwarded-for",
"version": "1.0.2",
"description": "hapi 17 plugin: sets request.info.remoteAddress from x-forwarded-for header",
"version": "2.0.0",
"description": "hapi 19 plugin: sets request.info.remoteAddress from x-forwarded-for header",
"main": "lib/index.js",
"scripts": {
"test": "mocha test/index.js"
Expand All @@ -26,11 +26,11 @@
"forwarded": "^0.1.2"
},
"peerDependencies": {
"hapi": "^17.1.1"
"@hapi/hapi": "^19.0.0"
},
"devDependencies": {
"chai": "^4.1.2",
"hapi": "^17.1.1",
"@hapi/hapi": "^19.0.0",
"mocha": "^4.0.1"
}
}
4 changes: 2 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const chai = require('chai');
const expect = chai.expect;

const Hapi = require('hapi');
const Hapi = require('@hapi/hapi');
const HapiForwardedFor = require('..');

describe('x-forwarded-for -> remoteAddress', function () {
Expand Down Expand Up @@ -53,4 +53,4 @@ describe('x-forwarded-for -> remoteAddress', function () {
expect(res.statusCode).to.equal(200);
expect(res.result).to.equal('127.0.0.1');
});
});
});
Loading

0 comments on commit c1d4b2f

Please sign in to comment.