anybody know how to post a json payload with planck.http?
I'm having trouble seeing how based on the docs: https://cljdoc.org/d/planck/planck/2.23.0/api/planck.http#post
@austin.chamberlin Via opts
you can control things like :accept
an :content-type
(Be sure to check out “the relevant options for get”)
Part of the trouble is I don't understand much about http.
(def payload "{\"some\": \"json\"}")
(planck.http/post "<https://url.com>" {:content-type :json } )
I'm wondering how I would send that payload
It would go under the :body
key in opts
ah got it
thanks Mike
No problem
@austin.chamberlin This might be helpful: https://github.com/planck-repl/planck/blob/master/planck-cljs/test/planck/http_test.cljs#L170
Got another q: Is there a way to prompt for interactive input like:
Do the thing? (y/n):
:)
read-line
user=> (read-line) y “y”
requires user to hit enter
thanks bfabry
In addition to planck.core/read-line
there is also planck.core/read-password
which protects the input terminal.