diff --git a/src/browser.ts b/src/browser.ts index 84af0aa..6d8dcc6 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -235,10 +235,12 @@ async encodeImage(image: Uint8Array | string): Promise { * @returns {Promise} - The response object. */ async delete(request: DeleteRequest): Promise { - await utils.del(this.fetch, `${this.config.host}/api/delete`, { - name: request.model, - headers: this.config.headers - }) + await utils.del( + this.fetch, + `${this.config.host}/api/delete`, + { name: request.model }, + { headers: this.config.headers } + ) return { status: 'success' } } diff --git a/src/utils.ts b/src/utils.ts index aecc505..d2ca82e 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -113,7 +113,7 @@ const fetchWithHeaders = async ( ): Promise => { const defaultHeaders = { 'Content-Type': 'application/json', - Accept: 'application/json', + Accept: 'application/json', 'User-Agent': `ollama-js/${version} (${getPlatform()})`, } as HeadersInit @@ -211,6 +211,7 @@ export const del = async ( const response = await fetchWithHeaders(fetch, host, { method: 'DELETE', body: JSON.stringify(data), + headers: options?.headers }) await checkOk(response)