Fork me on GitHub

I'm trying to adjust settings on ElasticSearch with Planck. ElasticSearch wants a JSON blob on a PUT request. How would I format this appropriately with planck.http/put? This is the curl equivalent:

curl -XPUT '' -d '{… blob …}'


@henrik If you do the following curl command (specifying JSON content type)

curl -XPUT '' -H "Content-Type: application/json" -d '{:foo 1}'
then the equivalent in Planck would be:
(planck.http/put "" {:content-type "application/json" :body "{foo: 1}"})


Otherwise, curl is actually sending a content-type of application/x-www-form-urlencoded, and in that case a curl request like

curl -XPUT '' -d 'foo=1'
has the following equivalent in Planck:
(http/put "" {:form-params {:foo 1}})
(But I suspect you really want to work with JSON given your description.)


Cool! I didn't see in the docs that you could set :body explicitly. Thank you!


Actually, my bad, it's in the spec.