diff --git a/packages/core/src/fetch.ts b/packages/core/src/fetch.ts index fa1e3a3e77..1f892db93f 100644 --- a/packages/core/src/fetch.ts +++ b/packages/core/src/fetch.ts @@ -163,12 +163,12 @@ export function traceFetchPost( ? "Bearer ***" // Mask Bearer tokens : "***") // Mask other authorization headers ) - const cmd = `curl ${url} \\ + const cmd = `curl "${url}" \\ +--no-buffer \\ ${Object.entries(headers) .map(([k, v]) => `-H "${k}: ${v}"`) - .join("\\\n")} \\ + .join(" \\\n")} \\ -d '${JSON.stringify(body, null, 2).replace(/'/g, "'\\''")}' ---no-buffer ` if (trace) trace.detailsFenced(`✉️ fetch`, cmd, "bash") else logVerbose(cmd) diff --git a/packages/core/src/openai.ts b/packages/core/src/openai.ts index 938603e1e0..7715cf2333 100644 --- a/packages/core/src/openai.ts +++ b/packages/core/src/openai.ts @@ -203,8 +203,8 @@ export const OpenAIChatCompletion: ChatCompletionHandler = async ( trace.dispatchChange() const fetchHeaders: HeadersInit = { - ...getConfigHeaders(cfg), "Content-Type": "application/json", + ...getConfigHeaders(cfg), ...(headers || {}), } traceFetchPost(trace, url, fetchHeaders as any, postReq)