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

Function createMockRequest

benchmarks/auth.js:35–50  ·  view source on GitHub ↗

* Creates mock request objects for testing

(options = {})

Source from the content-addressed store, hash-verified

33 * Creates mock request objects for testing
34 */
35function createMockRequest (options = {}) {
36 return {
37 method: options.method || "GET",
38 url: options.url || "/protected/resource",
39 headers: options.headers || {},
40 sessionID: options.sessionID || "test-session-123",
41 ip: options.ip || "127.0.0.1",
42 parsed: {
43 pathname: options.url || "/protected/resource",
44 searchParams: new URLSearchParams()
45 },
46 body: options.body || "",
47 isAuthenticated: options.isAuthenticated || (() => false),
48 ...options
49 };
50}
51
52/**
53 * Creates mock response objects for testing

Callers 4

benchmarkBasicAuthFunction · 0.70
benchmarkBearerAuthFunction · 0.70
benchmarkJwtAuthFunction · 0.70
testAuthMemoryUsageFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected