babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
Jakub Zika 2021-07-02T13:32:21.296300Z

Hi everyone I am trying to post JSON data via CURL from babashka/shell. as following: curl -i -X POST "-H" "Content-Type: application/json" -d '{"text":"test"}' $SLACKURI FIrst try and failure:

(shell/sh "sh" "-c" (clojure.string/join " " ["curl" "-i" "-X" "POST" "-H" "\\\"Content-Type: application/json\\\"" "-d" (str "'{\\\"text\\\":\\\"""test""\\\"}'") slack-uri]))))

=> "HTTP/2 400 \r\ndate: Fri, 02 Jul 2021 13:18:07 GMT\r\nserver: Apache\r\nstrict-transport-security: max-age=31536000; includeSubDomains; preload\r\nx-slack-backend: r\r\naccess-control-allow-origin: *\r\nx-frame-options: SAMEORIGIN\r\nvary: Accept-Encoding\r\nreferrer-policy: no-referrer\r\ncontent-type: text/html\r\nx-envoy-upstream-service-time: 9\r\nx-backend: main_normal main_canary_with_overflow main_control_with_overflow\r\nx-server: slack-www-hhvm-main-iad-6ilj\r\nx-via: envoy-www-iad-of34, haproxy-edge-fra-bdlo\r\nx-slack-shared-secret-outcome: shared-secret\r\nvia: envoy-www-iad-of34\r\n\r\ninvalid_payload"
Second try and failure:
(shell/sh "curl" "-i" "-X" "POST" "-H" "Content-Type: application/json" "-d" "'{\"text\":\"test\"}'"  slack-uri)

=> {:exit 0, :out "HTTP/2 400 \r\ndate: Fri, 02 Jul 2021 13:25:44 GMT\r\nserver: Apache\r\nstrict-transport-security: max-age=31536000; includeSubDomains; preload\r\nx-slack-backend: r\r\naccess-control-allow-origin: *\r\nx-frame-options: SAMEORIGIN\r\nvary: Accept-Encoding\r\nreferrer-policy: no-referrer\r\ncontent-type: text/html\r\nx-envoy-upstream-service-time: 12\r\nx-backend: main_normal main_canary_with_overflow main_control_with_overflow\r\nx-server: slack-www-hhvm-canary-main-iad-8qva\r\nx-via: envoy-www-iad-fna1, haproxy-edge-fra-ot10\r\nx-slack-shared-secret-outcome: shared-secret\r\nvia: envoy-www-iad-fna1\r\n\r\ninvalid_payload", :err "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\r100    32    0    15  100    17     42     47 --:--:-- --:--:-- --:--:--    89\n"}
I am sure I tried a lot of other forms along the way… but none was successful 😞.

ericdallo 2021-07-02T13:35:17.297900Z

Just curious, why babashka changed its release files extension to .tar.gz replacing .zip ?

borkdude 2021-07-02T13:35:42.298100Z

This had to do with unzip not being available on some linuxes

👍 1
ericdallo 2021-07-02T13:35:58.298300Z

that's what I thought, makes sense

borkdude 2021-07-02T13:36:12.298500Z

most notably chrome tablets I think

👍 1
Jakub Zika 2021-07-02T14:56:38.298900Z

@borkdude Thanks, i forgot about curl wrapper. Works now!

dharrigan 2021-07-02T15:02:25.299300Z

Just looking through the doc

dharrigan 2021-07-02T15:02:42.299800Z

does bb support custom mvn/repos for downloading private jars?

dharrigan 2021-07-02T15:03:01.300200Z

can't see anything in the book that talks about setting that up

borkdude 2021-07-02T15:04:37.300600Z

@dharrigan I think you can do that as part of the bb.edn.

dharrigan 2021-07-02T15:04:52.300800Z

same keys as in deps.edn?

borkdude 2021-07-02T15:04:55.301Z

yes

dharrigan 2021-07-02T15:04:57.301200Z

will try

borkdude 2021-07-02T16:29:37.301300Z

rwstauner 2021-07-02T23:29:07.302400Z

i knew babashka was fast, but i didn't expect to use bb tasks to launch a web server and a test suite that makes a dozen requests against it to finish in 0.1s :speeder:

🚀 1