Fork me on GitHub
#joker
<
2020-01-17
>
gleisonsilva11:01:39

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?

gleisonsilva11:01:41

In another words -> how to convert a regular Clojure map into a valid content to :body map value?

Candid20:01:43

:body is just a string that can be whatever you want it to be

Candid20:01:25

if you want to convert a map to JSON encoded string, look at joker.json namespace.

jcburley16:01:39

Have you checked out joker.hiccup/html?

jcburley20:01:57

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!

didibus03:01:39

Wouldn't the interpretation mean it can never be as fast as Go ?

Candid00:01:41

James is referring to start up time, not the actual execution speed.

👍 8
hlship20:01:11

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.

jvtrigueros21:01:09

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!

hlship20:01:22

Of course, it is awesome that you can do that!

hlship21:01:16

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

👍 4