Open geolessel opened 3 years ago
From the curl
manpage:
-d, --data <data>
...
If you start the data with the letter @, the rest should be a
file name to read the data from, or - if you want curl to read
the data from stdin. Posting data from a file named 'foobar'
would thus be done with -d, --data @foobar. When -d, --data is
told to read from a file like that, carriage returns and new‐
lines will be stripped out. If you do not want the @ character
to have a special interpretation use --data-raw instead.
...
--data-binary <data>
(HTTP) This posts data exactly as specified with no extra pro‐
cessing whatsoever.
If you start the data with the letter @, the rest should be a
filename. Data is posted in a similar manner as -d, --data does,
except that newlines and carriage returns are preserved and con‐
versions are never done.
The generated curl command uses -d
. I think it would be a safer option to use --data-binary
, though it might be nice to allow both with an option.
I thought about it and default curl behaviour (as well as the README example) is to assume form data. So I made a PR to add a new option --data-binary
. #59
Hi and thanks for the great package!
I've been using org-mode and ob-http to learn Elasticsearch. One of the endpoints allows a submission of
Content-Type: application/x-ndjson
and requires an final newline in the request body. However, no matter how many newlines I enter into the source block, I keep getting the same error that it needs a trailing newline. It would be great to have an option to retain trailing newlines (or at least add one on execution).An example of one of my requests: