MCPcopy Create free account
hub / github.com/avoidwork/tenso / overrideFunction

Function overrideFunction

benchmarks/rate-limiting.js:329–349  ·  view source on GitHub ↗
(req, state)

Source from the content-addressed store, hash-verified

327
328 // Mock override function
329 const overrideFunction = (req, state) => {
330 // VIP users get higher limits
331 if (req.headers["x-user-type"] === "vip") {
332 return {
333 ...state,
334 limit: state.limit * 10,
335 remaining: state.remaining * 10
336 };
337 }
338
339 // API keys get different limits
340 if (req.headers["x-api-key"]) {
341 return {
342 ...state,
343 limit: 1000,
344 remaining: 1000
345 };
346 }
347
348 return state;
349 };
350
351 const checkRateWithOverride = req => {
352 let state = {

Callers 1

checkRateWithOverrideFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected