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

hapi-ratelimiter

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-ratelimiter - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

3

lib/index.js

@@ -8,2 +8,3 @@ 'use strict';

const Limiter = require('ratelimiter');
const RequestIp = require('request-ip');

@@ -37,3 +38,3 @@ const internals = {

if (routeLimit) {
const ipts = [settings.namespace, request.info.remoteAddress, route.path].join(':');
const ipts = [settings.namespace, RequestIp.getClientIp(request), route.path].join(':');
const routeLimiter = new Limiter({

@@ -40,0 +41,0 @@ id: ipts,

{
"name": "hapi-ratelimiter",
"version": "1.1.1",
"version": "1.2.0",
"description": "A rate limiting plugin for Hapi.",

@@ -26,8 +26,9 @@ "main": "lib/index.js",

"ms": "0.x.x",
"ratelimiter": "2.x.x"
"ratelimiter": "2.x.x",
"request-ip": "^1.2.2"
},
"devDependencies": {
"code": "2.x.x",
"code": "4.x.x",
"hapi": ">=11",
"lab": "8.x.x"
"lab": "11.x.x"
},

@@ -34,0 +35,0 @@ "repository": {

@@ -59,8 +59,8 @@ 'use strict';

expect(response.statusCode).to.equal(200);
expect(response.result).to.deep.equal({ success: true });
expect(response.headers).to.include(
expect(response.result).to.equal({ success: true });
expect(response.headers).to.include([
'x-ratelimit-limit',
'x-ratelimit-remaining',
'x-ratelimit-reset'
);
]);

@@ -159,7 +159,7 @@ expect(response.headers['x-ratelimit-remaining']).to.equal(1);

expect(response.statusCode).to.equal(200);
expect(response.headers).to.not.include(
expect(response.headers).to.not.include([
'x-ratelimit-remaining',
'x-ratelimit-limit',
'x-ratelimit-reset'
);
]);
done();

@@ -204,7 +204,7 @@ });

expect(response.statusCode).to.equal(501);
expect(response.headers).to.not.include(
expect(response.headers).to.not.include([
'x-ratelimit-remaining',
'x-ratelimit-limit',
'x-ratelimit-reset'
);
]);
done();

@@ -211,0 +211,0 @@ });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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