Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl escape #534

Merged
merged 3 commits into from
Jun 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/src/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ export const OpenAIChatCompletion: ChatCompletionHandler = async (

trace.detailsFenced(
`โœ‰๏ธ fetch`,
`curl ${url} \\
`curl -X POST ${url} \\

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The curl command should specify the -X POST method to ensure the request is sent as a POST request. Great catch on updating this! ๐Ÿ‘

generated by pr-review-commit

pelikhan marked this conversation as resolved.
Show resolved Hide resolved
-H "Content-Type: application/json" \\
${Object.entries(cfg.curlHeaders || {})
.map(([k, v]) => `-H "${k}: ${v}" \\`)
.join("\n")}
-d '${JSON.stringify(postReq, null, 2)}'
-d '${JSON.stringify(postReq).replace(/'/g, "'\\''")}'
pelikhan marked this conversation as resolved.
Show resolved Hide resolved
pelikhan marked this conversation as resolved.
Show resolved Hide resolved
pelikhan marked this conversation as resolved.
Show resolved Hide resolved
`,
"bash"
)
Expand Down
Loading