MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / formRequest

Method formRequest

packages/server-e2e/src/http.ts:139–169  ·  view source on GitHub ↗
(
    method: 'POST',
    path: string,
    body: FormData,
  )

Source from the content-addressed store, hash-verified

137 }
138
139 private async formRequest<T>(
140 method: 'POST',
141 path: string,
142 body: FormData,
143 ): Promise<T> {
144 const url = this.url(path);
145 const res = await fetchWithReport(
146 url,
147 {
148 method,
149 headers: { accept: 'application/json' },
150 body,
151 },
152 {
153 fetchImpl: this.opts.fetchImpl,
154 reportDir: this.opts.reportDir,
155 path,
156 },
157 );
158 const text = await res.text();
159 let envelope: Envelope<T>;
160 try {
161 envelope = JSON.parse(text) as Envelope<T>;
162 } catch (error) {
163 throw new Error(
164 `server ${method} ${path} returned non-JSON (HTTP ${res.status}): ${text.slice(0, 200)}`,
165 { cause: error },
166 );
167 }
168 return unwrap(envelope);
169 }
170
171 // ── Probes + model catalog ─────────────────────────────────────────────
172 getAuth(): Promise<AuthSummary> {

Callers 1

uploadFileMethod · 0.95

Calls 4

urlMethod · 0.95
fetchWithReportFunction · 0.85
unwrapFunction · 0.85
textMethod · 0.65

Tested by

no test coverage detected