MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / createMockRequest

Function createMockRequest

packages/server/src/utils/mockRequest.ts:26–48  ·  view source on GitHub ↗
(options: MockRequestOptions)

Source from the content-addressed store, hash-verified

24 * - req.files
25 */
26export function createMockRequest(options: MockRequestOptions): Request {
27 const { chatflowId, body = {}, sourceRequest, files = [] } = options
28
29 const headers: Record<string, string | string[] | undefined> = sourceRequest ? { ...sourceRequest.headers } : { host: 'localhost:3000' }
30
31 return {
32 params: { id: chatflowId },
33 body: {
34 streaming: true,
35 question: '',
36 ...body
37 },
38 get: (header: string) => {
39 if (sourceRequest) return sourceRequest.get(header)
40 const lower = header.toLowerCase()
41 const val = headers[lower]
42 return typeof val === 'string' ? val : undefined
43 },
44 protocol: sourceRequest?.protocol ?? 'http',
45 headers,
46 files
47 } as unknown as Request
48}

Callers 2

chatflowCallbackFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected