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

Function createMockRequest

benchmarks/rate-limiting.js:38–51  ·  view source on GitHub ↗

* Creates mock request objects for testing

(options = {})

Source from the content-addressed store, hash-verified

36 * Creates mock request objects for testing
37 */
38function createMockRequest (options = {}) {
39 return {
40 method: options.method || "GET",
41 url: options.url || "/api/test",
42 headers: options.headers || {},
43 sessionID: options.sessionID || `session-${Math.random()}`,
44 ip: options.ip || `192.168.1.${Math.floor(Math.random() * 255)}`,
45 parsed: {
46 pathname: options.url || "/api/test",
47 searchParams: new URLSearchParams()
48 },
49 ...options
50 };
51}
52
53/**
54 * Creates mock response objects for testing

Callers 4

benchmarkBasicRateLimitFunction · 0.70
benchmarkDifferentLimitsFunction · 0.70
benchmarkWindowResetFunction · 0.70
benchmarkRateOverrideFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected