MCPcopy Create free account
hub / github.com/massCodeIO/massCode / interpolateRequest

Function interpolateRequest

src/main/ipc/handlers/http.ts:59–89  ·  view source on GitHub ↗
(
  request: HttpExecuteRequest,
  variables: Record<string, string>,
)

Source from the content-addressed store, hash-verified

57}
58
59function interpolateRequest(
60 request: HttpExecuteRequest,
61 variables: Record<string, string>,
62): HttpExecuteRequest {
63 return {
64 method: request.method,
65 url: interpolate(request.url, variables),
66 headers: request.headers.map(h => ({
67 ...h,
68 value: interpolate(h.value, variables),
69 })),
70 query: request.query.map(q => ({
71 ...q,
72 value: interpolate(q.value, variables),
73 })),
74 bodyType: request.bodyType,
75 body:
76 request.body !== null
77 ? interpolate(request.body, variables)
78 : request.body,
79 formData: request.formData.map(entry => ({
80 key: entry.key,
81 type: entry.type,
82 value:
83 entry.type === 'text'
84 ? interpolate(entry.value, variables)
85 : entry.value,
86 })),
87 auth: interpolateAuth(request.auth, variables),
88 }
89}
90
91export function applyAuth(
92 auth: HttpAuth,

Callers 1

executeHttpRequestFunction · 0.85

Calls 2

interpolateFunction · 0.85
interpolateAuthFunction · 0.70

Tested by

no test coverage detected