class

MartenThrottle::Middleware

Inherits Marten::Middleware < Reference < Object

Rate-limiting middleware.

Skip requests first, pick the first rule whose matcher accepts the request, then fall back to an explicitly configured default policy. Throttled responses receive rate-limit headers; on rejection, returns 429 with Retry-After.

Constants

GLOBAL_CLIENT = "global"

Constructors

Instance methods

Calls the middleware for a given HTTP request and returns a HTTP response.

This method must be implemented by subclasses: it takes a request argument (the current HTTP request) and a get_response proc that allows to get the final response. This proc might actually call the next middleware in the chain of configured middlewares, or the final matched handler. That way, the current middleware have the ability to intercept any incoming request and the associated response, and to modify them if applicable.

Source