onur-ozkan / nestjs-rate-limiter

Highly configurable and extensible rate limiter library
https://npmjs.com/package/nestjs-rate-limiter
MIT License
238 stars 43 forks source link

Will it work with NestJs using Fastify? #5

Closed anwaar931 closed 4 years ago

anwaar931 commented 4 years ago
[Nest] 76   - 10/24/2019, 9:16:33 AM   [ExceptionsHandler] response.set is not a function +807ms
TypeError: response.set is not a function
at RateLimiterInterceptor.<anonymous> (/usr/src/service/service-api/node_modules/nestjs-rate-limiter/dist/rate-limiter.interceptor.js:126:26)

It throws this error.

RyanTheAllmighty commented 4 years ago

I'll take a look.

I only tested with the default express implementation. I'll take a look at Fastify and try and identify the issue and at minimum make a note in the README

onur-ozkan commented 4 years ago

Until this repository supports fastify, anybody who wants to use this package on fastify can install from https://github.com/feednext/nestjs-rate-limiter with npm i --save nestjs-fastify-rate-limiter. Nothing changed for usage wise, @RyanTheAllmighty take a look at what I have changed and implement it to this package when you have time. I think you should take parameter on initialization like 'express' or 'fastify' and do the job conditionally in interceptor.

onur-ozkan commented 4 years ago

Also, custom error message support added

onur-ozkan commented 4 years ago

Moved to #17