Hello! I'm trying to make a HTTP post request using joker.http/send
but I'm not figured out yet how to pass the parameters into the :body
request map value... has anyone an example of that?
In another words -> how to convert a regular Clojure map into a valid content to :body
map value?
Have you checked out joker.hiccup/html
?
The latest version, just pushed, squeezes another 2ms or so out of startup time on my MacBook Pro (OS X), though it's barely measurable as an improvement on my Ryzen 3:
https://github.com/jcburley/joker/tree/gen-code
Build via ./run.sh
as usual; the resulting joker
executable, also named (via hardlink) joker.fast
, is the fast-startup version, while joker.slow
is the normal version.
I hope to make this PR-able by next Thursday, possibly sooner. Needs more cleanup, but the list of known optimizations to pursue is now empty. (The list could start growing again if somebody analyzes why it's still 2.5x or so slower starting up than a simply command-line-echo program written in Go.)
Enjoy!
James is referring to start up time, not the actual execution speed.
:body
is just a string that can be whatever you want it to be
if you want to convert a map to JSON encoded string, look at joker.json
namespace.
Where are we in terms of a REPL (preferably from Cursive)? I'm working on some tricky stuff and decided to develop it in Clojure in Cursive, then copy-and-paste into my Joker code.
Of course, it is awesome that you can do that!
[ANN] multi 1.1.0
https://github.com/hlship/multi
I've enhanced multi with a new defcommand
macro that eliminates a lot of tedium in writing commands.
(multi/defcommand configure
"Configures the system with keys and values"
[verbose ["-v" "--verbose" "Enable verbose logging"]
:args
host ["HOST" "System configuration URL"
:validate [#(re-matches #"https?://.+" %) "must be a URL"]]
key-values ["DATA" "Data to configure as KEY=VALUE"
:parse-fn (fn [s]
(when-let [[_ k v] (re-matches #"(.+)=(.+)" s)]
[(keyword k) v]))
:update-fn (fn [m [k v]]
(assoc m k v))
:repeatable true]]
(do-configure host key-values {:verbose verbose}))
Here's a larger example of defcommand
in action: https://github.com/hlship/threaded-conversation/commit/e3227b42c24df39fc57c30c69a9aefe28b8e6218
Cursive can now do Socket REPL but still isn't able to evaluate forms in the Joker REPL. I can see them both connecting. Perhaps you have better luck!