curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

[Feature request] Multiple --data options without &-symbol

From: Borja Iñesta Hernández (UPV) <curl-users_at_lists.haxx.se>
Date: Wed, 25 Oct 2023 17:30:37 +0200

Hello!

Currently, when specifying more than one --data options with curl, the data pieces specified are merged with a separating &-symbol.

While creating a request for a 3GPP API, I had the need of mixing JSON data with binary data in a multipart/related content-type request and each time a --data option is used, the data is joined by the & symbol, making the request useless.

Example:
curl --http2-prior-knowledge \
  --request POST \
  --header "Content-Type: multipart/related; boundary=‘=-myboundary=='" \
  --data-binary $'--=-myboundary==\r\nContent-Type: application/json\r\n\r\n' \
  --data _at_data.json \
  --data-binary $'\r\n--=-myboundary==\r\nContent-Type: application/vnd.3gpp.5gnas\r\n\r\n' \
  --data-binary _at_nas_pdu.bin \
  --data-binary $'\r\n--=-myboundary==--\r\n' \
webserver:80/resource

I thought something like this could be useful in some environments, like specifying the request like this and not having the data parts merged with & by adding a special option like --avoid-merge.



-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-10-25