Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

681 B
Raw Blame
import type { Dispatcher } from 'undici'

export type FetchInit = RequestInit & {
  dispatcher?: Dispatcher
  tls?: { rejectUnauthorized: boolean }
}

export type FetchInitOptions = Readonly<{
  insecure: boolean
  dispatcher?: Dispatcher
}>

// Shared by src/plugins/http.ts and src/auth/device-api.ts: both send requests
// that may need TLS verification skipped and/or routed through a proxy dispatcher.
export function buildFetchInit(base: RequestInit, opts: FetchInitOptions): FetchInit {
  const init: FetchInit = { ...base }
  if (opts.insecure) init.tls = { rejectUnauthorized: false }
  if (opts.dispatcher !== undefined) init.dispatcher = opts.dispatcher
  return init
}