OK, thanks. I'll await your results.
I think it might also be good to post an issue about this to oracle/graal, since it seems they intended to fix the issue
instead of us working around it
commented here now: https://github.com/oracle/graal/issues/841#issuecomment-602181005
I've tried with try/catch. The same failure.
ok, then our decision was good
It turns out that lambda runtime has curl. So no external dependencies needed. Then the issue is to parse curl response with headers. @borkdude do you plan to support parsing curl response into {:headers {} :body "" :ect :etc}
in babashka.curl?
@dainius.jocas Cool. I think it's good to have support for this, but it's not currently implemented.
Another issue with using curl is that it is much much slower, than clj-http-lite. The echo took 200ms consistently to execute while clj-http-lite take 15ms. Here is my naive implementation of curl response parsing https://gist.github.com/dainiusjocas/d2a5ca60ae25cd260f37b7c125a0b2e6
why would curl be slower you think?
I made an issue for parsing the headers here: https://github.com/borkdude/babashka.curl/issues/5
I think this should be optional, so maybe when passed an option like :response true
will return the full response map and when it's not set, it will return only the body?
no idea why it could be that much slower.
IMO, the current functionality should not change, so this response parsing should under some new param like :response true
. Note that response headers are retrieved with :raw-args ["-i"]
yeah, so when :response true
, use the "-i"
argument implicitly
👍
FWIW I see similar times between babashka.curl and slurp
user=> (time (do (curl/get "<https://www.clojure.org>") nil))
"Elapsed time: 75.406528 msecs"
nil
user=> (time (do (slurp "<https://www.clojure.org>") nil))