(req, state)
| 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 = { |
no outgoing calls
no test coverage detected