carbond.limiter.FunctionLimiter¶
FunctionLimiter is the most basic limiter class.
Simply define fn and return
true to allow further processing of the request and false to end
processing.
NOTE: fn is responsible
for ending the request-response cycle if processing is to stop. This can be
accomplished by calling express.request.end (explicitly or
implicitly via send, render, or json) or by using the helper method
sendUnavailable.
Class¶
-
class
carbond.limiter.FunctionLimiter()¶ extends:
Limiter- ¶
fn FunctionDescription This function should either take the arguments (req, res)or(req, res, next). Note that these are the same arguments passed to a standard express middleware function. Ifnextis present in the argument list,fnwill be responsible for calling next. Otherwise, thefnshould returntrueto indicate that processing should continue orfalseto stop processing. In either case,fnis responsible for ending the request-response cycle if processing is to stop.
- ¶
process Arguments - req (
express.request) – the currentRequestobject - res (
express.response) – the currentResponseobject - next (
Function) – continuation
Description This wraps fn, catches any errors it may throw, and callsnextif appropriate.- req (