MCPcopy Create free account
hub / github.com/langgenius/dify / registerProxyRoute

Function registerProxyRoute

packages/dev-proxy/src/server.ts:212–224  ·  view source on GitHub ↗
(
  app: Hono,
  route: DevProxyRoute,
  path: string,
  fetchImpl: typeof globalThis.fetch,
  allowedOrigins: DevProxyCorsAllowedOrigins,
)

Source from the content-addressed store, hash-verified

210const normalizeRoutePaths = (paths: DevProxyRoute['paths']) => Array.isArray(paths) ? paths : [paths]
211
212const registerProxyRoute = (
213 app: Hono,
214 route: DevProxyRoute,
215 path: string,
216 fetchImpl: typeof globalThis.fetch,
217 allowedOrigins: DevProxyCorsAllowedOrigins,
218) => {
219 if (!path.startsWith('/'))
220 throw new Error(`Invalid dev proxy route path "${path}". Paths must start with "/".`)
221
222 app.all(path, context => proxyRequest(context, route, fetchImpl, allowedOrigins))
223 app.all(`${path}/*`, context => proxyRequest(context, route, fetchImpl, allowedOrigins))
224}
225
226const registerProxyRoutes = (
227 app: Hono,

Callers 1

registerProxyRoutesFunction · 0.85

Calls 3

proxyRequestFunction · 0.85
startsWithMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected