MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / put

Function put

src/services/utils/http.ts:160–176  ·  view source on GitHub ↗
(path: string, body?: unknown)

Source from the content-addressed store, hash-verified

158}
159
160export async function put<T>(path: string, body?: unknown): Promise<T> {
161 const hasBody = body !== undefined
162 const resp = await fetch(`${_baseUrl}${path}`, {
163 method: 'PUT',
164 headers: {
165 ...getAuthHeaders(),
166 ...(hasBody && { 'Content-Type': 'application/json' }),
167 },
168 ...(hasBody && { body: JSON.stringify(body) }),
169 })
170 handle401(resp)
171 if (!resp.ok) {
172 const text = await resp.text().catch(() => '')
173 throw new Error(`HTTP ${resp.status}: ${text}`)
174 }
175 return resp.json() as Promise<T>
176}
177
178export async function patch<T>(path: string, body?: unknown): Promise<T> {
179 const hasBody = body !== undefined

Callers 9

setFastModelMethod · 0.90
updateConfigMethod · 0.90
updateCustomProviderMethod · 0.90
updateCustomModelMethod · 0.90
service.tsFile · 0.90
updateMethod · 0.90
updateAIChatTitleMethod · 0.90
updateMethod · 0.90

Calls 3

getAuthHeadersFunction · 0.85
handle401Function · 0.85
textMethod · 0.80

Tested by

no test coverage detected