May 19, 11:17pm

Yes, you can simplify the curl command by letting curl automatically generate the boundary for you. Here’s how you can rewrite it:

bash
curl 'https://codeberg.org/Benjamin_Loison/Markdown/markup' \
  -H 'Content-Type: multipart/form-data' \
  -H 'Cookie: cb_sessionid=XXXXXXXXXXXXXXXXXXXX' \
  -F 'mode=comment' \
  -F 'text=$'"$'```python\nprint(\\'test\\')\n```'"

Key Changes:

  1. Removed the manual boundary: curl will generate its own boundary when the Content-Type header is set to multipart/form-data.
  2. Used -F for form data: This simplifies the construction of the multipart form data. You can pass the mode and text fields directly using -F.
  3. Escaped the Python code: The Python code is passed as a string using -F for the text field.

This achieves the same result but is much cleaner and easier to maintain.

May 19, 11:17pm

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Vibe can make mistakes. Check answers. Learn more