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

fastify-rate-limit

Package Overview
Dependencies
Maintainers
8
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-rate-limit - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

.taprc

16

package.json
{
"name": "fastify-rate-limit",
"version": "4.0.0",
"version": "4.0.1",
"description": "A low overhead rate limiter for your routes",

@@ -8,3 +8,3 @@ "main": "index.js",

"redis": "docker run -p 6379:6379 --rm redis:3.0.7",
"test": "standard && tap --cov test/*.test.js && npm run typescript",
"test": "standard && tap test/*.test.js && npm run typescript",
"typescript": "tsd"

@@ -28,14 +28,14 @@ },

"devDependencies": {
"@types/ioredis": "~4.16.0",
"@types/node": "~13.13.4",
"fastify": "^3.0.0-rc.1",
"@types/ioredis": "^4.17.0",
"@types/node": "^14.0.18",
"fastify": "^3.0.0",
"ioredis": "^4.9.0",
"knex": "^0.21.1",
"sqlite3": "^4.1.0",
"sqlite3": "^5.0.0",
"standard": "^14.0.2",
"tap": "^14.10.7",
"tsd": "^0.11.0"
"tsd": "^0.13.1"
},
"dependencies": {
"fast-json-stringify": "^2.0.0",
"fast-json-stringify": "^2.2.1",
"fastify-plugin": "^2.0.0",

@@ -42,0 +42,0 @@ "ms": "^2.1.1",

@@ -430,3 +430,3 @@ 'use strict'

fastify.ready((err) => {
t.strictEqual(err, null)
t.error(err)
fastify.inject('/', (err, res) => {

@@ -661,3 +661,5 @@ if (err) {}

test('limit reset per Local storage', t => {
// TODO this test gets extremely flaky because of setTimeout
// rewrite using https://www.npmjs.com/package/@sinonjs/fake-timers
test('limit reset per Local storage', { skip: true }, t => {
t.plan(12)

@@ -664,0 +666,0 @@ const fastify = Fastify()

import * as http from 'http'
import * as http2 from 'http2'
import fastify, { RouteOptions, FastifyRequest, FastifyInstance } from 'fastify';
import fastify, { RouteOptions, FastifyRequest, FastifyInstance, RequestGenericInterface } from 'fastify';
import * as ioredis from 'ioredis';

@@ -25,4 +25,4 @@ import fastifyRateLimit, { FastifyRateLimitStore, FastifyRateLimitOptions, errorResponseBuilderContext, RateLimitPluginOptions } from '../../';

ban: 10,
keyGenerator: (req: FastifyRequest<http.Server, http.IncomingMessage>) => req.ip,
errorResponseBuilder: (req: FastifyRequest<http.Server, http.IncomingMessage>, context: errorResponseBuilderContext) => ({ code: 429, timeWindow: context.after, limit: context.max }),
keyGenerator: (req: FastifyRequest<RequestGenericInterface>) => req.ip,
errorResponseBuilder: (req: FastifyRequest<RequestGenericInterface>, context: errorResponseBuilderContext) => ({ code: 429, timeWindow: context.after, limit: context.max }),
addHeaders: {

@@ -38,4 +38,4 @@ 'x-ratelimit-limit': false,

global: true,
max: (req: FastifyRequest<http.Server, http.IncomingMessage>, key: string) => (42),
whitelist: (req: FastifyRequest<http.Server, http.IncomingMessage>, key: string) => (false),
max: (req: FastifyRequest<RequestGenericInterface>, key: string) => (42),
whitelist: (req: FastifyRequest<RequestGenericInterface>, key: string) => (false),
timeWindow: 5000

@@ -46,3 +46,3 @@ }

global: true,
max: (req: FastifyRequest<http.Server, http.IncomingMessage>, key: string) => (42),
max: (req: FastifyRequest<RequestGenericInterface>, key: string) => (42),
timeWindow: 5000,

@@ -49,0 +49,0 @@ store: CustomStore

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