Fork me on GitHub
#babashka
<
2021-07-02
>
Jakub Zika13:07:21

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 😞.

Jakub Zika14:07:38

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

ericdallo13:07:17

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

borkdude13:07:42

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

👍 4
ericdallo13:07:58

that's what I thought, makes sense

borkdude13:07:12

most notably chrome tablets I think

👍 4
dharrigan15:07:25

Just looking through the doc

dharrigan15:07:42

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

dharrigan15:07:01

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

borkdude15:07:37

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

dharrigan15:07:52

same keys as in deps.edn?

rwstauner23:07:07

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

🚀 4