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 😞.I've got a similar script here. https://github.com/babashka/babashka/blob/11b066ae7096fd6306e430c4b13aa17c2a62a26b/.circleci/script/publish_artifact.clj
Just curious, why babashka changed its release files extension to .tar.gz replacing .zip ?
This had to do with unzip
not being available on some linuxes
that's what I thought, makes sense
most notably chrome tablets I think
@borkdude Thanks, i forgot about curl wrapper. Works now!
Just looking through the doc
does bb support custom mvn/repos
for downloading private jars?
can't see anything in the book that talks about setting that up
@dharrigan I think you can do that as part of the bb.edn
.
same keys as in deps.edn
?
yes
will try
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: