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

Function createRateLimitedServer

benchmarks/rate-limiting.js:17–33  ·  view source on GitHub ↗

* Creates a test server with rate limiting enabled

(rateConfig)

Source from the content-addressed store, hash-verified

15 * Creates a test server with rate limiting enabled
16 */
17function createRateLimitedServer (rateConfig) {
18 return tenso({
19 port: 0,
20 silent: true,
21 logging: { enabled: false },
22 auth: { protect: [] },
23 security: { csrf: false },
24 rate: {
25 enabled: true,
26 limit: 100,
27 reset: 900, // 15 minutes
28 status: 429,
29 message: "Too many requests",
30 ...rateConfig
31 }
32 });
33}
34
35/**
36 * Creates mock request objects for testing

Callers 1

benchmarkBasicRateLimitFunction · 0.85

Calls 1

tensoFunction · 0.90

Tested by

no test coverage detected