Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

request-ip

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

request-ip - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

.babelrc

26

CHANGELOG.md

@@ -5,4 +5,28 @@ # Change Log

[Full Changelog](https://github.com/pbojinov/request-ip/compare/2.0.0...HEAD)
[Full Changelog](https://github.com/pbojinov/request-ip/compare/2.0.2...HEAD)
**Closed issues:**
- Not getting the right ip first time [\#28](https://github.com/pbojinov/request-ip/issues/28)
- Allow using node \> 6 [\#27](https://github.com/pbojinov/request-ip/issues/27)
**Merged pull requests:**
- Get client ip when using AWS Api Gateway + Lambda. [\#35](https://github.com/pbojinov/request-ip/pull/35) ([rafaelthemendes](https://github.com/rafaelthemendes))
- redefine attribute getter [\#34](https://github.com/pbojinov/request-ip/pull/34) ([isayme](https://github.com/isayme))
## [2.0.2](https://github.com/pbojinov/request-ip/tree/2.0.2) (2017-06-26)
[Full Changelog](https://github.com/pbojinov/request-ip/compare/2.0.1...2.0.2)
**Closed issues:**
- azure web app adds port to x-forwarded-for [\#29](https://github.com/pbojinov/request-ip/issues/29)
**Merged pull requests:**
- handling x-forwarded-for with ip:port [\#30](https://github.com/pbojinov/request-ip/pull/30) ([luisrudge](https://github.com/luisrudge))
## [2.0.1](https://github.com/pbojinov/request-ip/tree/2.0.1) (2017-03-09)
[Full Changelog](https://github.com/pbojinov/request-ip/compare/2.0.0...2.0.1)
**Implemented enhancements:**

@@ -9,0 +33,0 @@

2

LICENSE.md
The MIT License (MIT)
Copyright (c) 2017 Petar Bojinov - petarbojinov@gmail.com
Copyright (c) 2018 Petar Bojinov - petarbojinov@gmail.com

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of

{
"name": "request-ip",
"version": "2.0.2",
"version": "2.1.0",
"description": "A small node.js module to retrieve the request's IP address",
"main": "index.js",
"main": "./dist/index.js",
"repository": {

@@ -11,5 +11,6 @@ "type": "git",

"scripts": {
"test": "./node_modules/.bin/nyc --reporter=html --reporter=text --check-coverage --lines=100 --statements=100 tape ./test/*.js",
"test": "./node_modules/.bin/nyc --reporter=html --reporter=text --check-coverage --lines=100 --statements=100 ./node_modules/tape/bin/tape ./test/index.js",
"coverage": "./node_modules/.bin/nyc report --reporter=text-lcov | coveralls",
"changelog": "github_changelog_generator -t 4c910e93a260e924d44e800b1a4345bf1115c532"
"changelog": "github_changelog_generator -u pbojinov -p request-ip",
"build": "./node_modules/.bin/babel ./src/index.js > ./dist/index.js"
},

@@ -45,2 +46,5 @@ "keywords": [

"devDependencies": {
"@babel/cli": "^7.0.0-beta.51",
"@babel/core": "^7.0.0-beta.51",
"@babel/preset-env": "^7.0.0-beta.51",
"coveralls": "^2.11.2",

@@ -50,6 +54,6 @@ "eslint": "^3.17.0",

"eslint-plugin-import": "^2.2.0",
"nyc": "^10.1.2",
"nyc": "^12.0.2",
"request": "^2.54.0",
"tap-spec": "^4.1.1",
"tape": "^4.6.3"
"tap-spec": "^5.0.0",
"tape": "^4.9.1"
},

@@ -56,0 +60,0 @@ "dependencies": {

const http = require('http');
const request = require('request');
const requestIp = require('../index.js');
const requestIp = require('../src/index.js');
const tapSpec = require('tap-spec');

@@ -398,2 +398,14 @@ const test = require('tape');

test('getClientIp - req.requestContext.identity.sourceIp', (t) => {
t.plan(1);
const found = requestIp.getClientIp({
requestContext: {
identity: {
sourceIp: '50.18.192.250',
},
},
});
t.equal(found, '50.18.192.250');
});
test('getClientIp - default', (t) => {

@@ -434,2 +446,18 @@ t.plan(1);

test('request-ip.mw - attribute has getter by Object.defineProperty', (t) => {
t.plan(2);
const mw = requestIp.mw();
t.ok(typeof mw === 'function' && mw.length === 3, 'returns a middleware');
const mockReq = { headers: { 'x-forwarded-for': '111.222.111.222' } };
Object.defineProperty(mockReq, 'clientIp', {
enumerable: true,
configurable: true,
get: () => '1.2.3.4',
});
mw(mockReq, null, () => {
t.equal(mockReq.clientIp, '111.222.111.222', "when used - the middleware augments the request object with attribute 'clientIp'");
});
});
test('android request to AWS EBS app (x-forwarded-for)', (t) => {

@@ -436,0 +464,0 @@ t.plan(1);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc