It would be great enhancement to be able to define a custom function which is called when rate limit is exceeded, instead of being limited to: if (shouldLimit) { res.status(429).send('Rate limit exceeded'); return; }
For example, when using a Swagger for building APIs and want that they produce application/json the res.status(429).send('Rate limit exceeded'); returns error.
Would it be possible to add such enhancement, to be able to respond rate limit exceeded in different format, e.g. in JSON such as res.status(429).json({message: 'Rate limit exceeded'}); ?
It would be great enhancement to be able to define a custom function which is called when rate limit is exceeded, instead of being limited to:
if (shouldLimit) { res.status(429).send('Rate limit exceeded'); return; }
For example, when using a Swagger for building APIs and want that they produce
application/json
theres.status(429).send('Rate limit exceeded');
returns error.Would it be possible to add such enhancement, to be able to respond rate limit exceeded in different format, e.g. in JSON such as
res.status(429).json({message: 'Rate limit exceeded'});
?