planck

Planck ClojureScript REPL
2019-10-28T16:14:40.000800Z

anybody know how to post a json payload with planck.http?

2019-10-28T16:15:55.001100Z

I'm having trouble seeing how based on the docs: https://cljdoc.org/d/planck/planck/2.23.0/api/planck.http#post

mfikes 2019-10-28T16:32:23.001600Z

@austin.chamberlin Via opts you can control things like :accept an :content-type

mfikes 2019-10-28T16:33:17.001900Z

(Be sure to check out “the relevant options for get”)

2019-10-28T16:46:43.002900Z

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 } )

2019-10-28T16:46:57.003300Z

I'm wondering how I would send that payload

mfikes 2019-10-28T16:47:51.003800Z

It would go under the :body key in opts

2019-10-28T16:48:05.004100Z

ah got it

2019-10-28T16:48:08.004300Z

thanks Mike

mfikes 2019-10-28T16:48:16.004600Z

No problem

2019-10-28T21:51:20.006300Z

Got another q: Is there a way to prompt for interactive input like:

Do the thing? (y/n):

slipset 2019-10-29T10:11:46.008300Z

:)

2019-10-28T21:53:49.006400Z

read-line

2019-10-28T21:54:15.006600Z

user=> (read-line) y “y”

2019-10-28T21:54:24.006800Z

requires user to hit enter

2019-10-28T21:56:10.007Z

thanks bfabry

mfikes 2019-10-28T22:52:29.007200Z

In addition to planck.core/read-line there is also planck.core/read-password which protects the input terminal.