3 ms·
For longer than I can recall I've had a `post_json` alias like this: curl -H'Content-Type: application/json' -d @- << 'JSON' Invoke with post_json <u
by darrenf 5y ago
For longer than I can recall I've had a `post_json` alias like this:
curl -H'Content-Type: application/json' -d @- << 'JSON'
Invoke with
post_json <url>
Then just paste or write JSON without caring about quotes etc, finish the heredoc, done.
- tomsmeding 5y agoDon't you need `<<'JSON'` instead of `<<JSON`? Otherwise any $ in the json body would be interpreted as a shell variable reference.
- darrenf 5y agoYes, I mistyped on my phone. Edited, thanks!
- paledot 5y agoTIL you could open (and not close) a heredoc string in an alias.