TIL

curl --json sets both headers for you

Since curl 7.82, --json sends the body as data and sets Content-Type and Accept to application/json in one go.

$ curl --json '{"url":"https://example.org/a/long/path"}' localhost:8080/api/links
{"code":"k3x9","url":"https://example.org/a/long/path"}

Before, I typed -H twice and forgot one of them every other time.

Comments

Buy Logbuch