Fork me on GitHub
#babashka
<
2020-06-08
>
borkdude08:06:18

Over the weekend I made some progress with defprotocol et. al. If you want you can test it using the babashka defprotocol branch or grab a binary from https://clojurians.slack.com/archives/CSDUA8S6B/p1591567157005700. It also includes compatibility with defrecord.

borkdude08:06:18

Over the weekend I made some progress with defprotocol et. al. If you want you can test it using the babashka defprotocol branch or grab a binary from https://clojurians.slack.com/archives/CSDUA8S6B/p1591567157005700. It also includes compatibility with defrecord.

borkdude08:06:04

One thing that now works is the camel-snake-kebab library.

jeroenvandijk08:06:48

Thanks @borkdude!

borkdude13:06:23

@d.ian.b bb doesn't have a built-in webserver, but you can roll your own using that code yes. what's your use case for wanting a webserver in bb?

d.ian.b13:06:52

no worries, It's just for a test

d.ian.b13:06:00

but thanks @borkdude 😃

borkdude17:06:12

is anyone using babashka in aws lambda aware of this issue? https://github.com/borkdude/babashka/pull/462

borkdude17:06:12

is anyone using babashka in aws lambda aware of this issue? https://github.com/borkdude/babashka/pull/462

viesti17:06:10

Hum, haven't run into that, but haven't used babashka in lambda in anger 🙂

borkdude17:06:24

do you remember which version you ran on aws?

jkrasnay18:06:48

I’m using babashka.curl to post some JSON from a string, something like this {:body "{\"foo\": \"bar\"}" but by the time it hits the server those inner, escaped quotes have been removed, so the server sees {foo: bar} , which of course is invalid. Is there a some way to fix this?

borkdude18:06:56

that's pretty weird

borkdude18:06:16

you could try some debugging here: https://github.com/borkdude/babashka.curl it runs as a JVM lib as well

bherrmann18:06:00

I do this often,

(def login-body "{ \"password\": \"shesh\", \"username\": \"bob\"}" )
(def headers {"Content-Type" "application/json"})
(curl/post req-url { :headers headers :body login-body })]

borkdude18:06:18

also, you can try (post "foo" {:body ... :debug true}) which will also return the :command which was used to invoke curl

jkrasnay18:06:24

:debug shows the quotes are still escaped on the command-line. Maybe it’s a Windows Powershell thing (I’m normally a Mac guy)

borkdude18:06:24

well, it doesn't go through powershell, but there might be an issue with ProcessBuilder on Windows...

borkdude18:06:43

I remember something similar with clj-kondo. let me check

borkdude18:06:17

so for some reason I had to replace escaped quotes with \\\"

borkdude18:06:14

could you try this with babashka.curl on Windows perhaps?

jkrasnay18:06:50

Doing that now…

jkrasnay18:06:03

Yes, that seems to work.

borkdude18:06:01

so I think we need to patch babashka.curl for windows to do this for you

borkdude18:06:34

(if (and windows? (string? body) ...) (str/replace ...) ...)

jkrasnay18:06:59

That Microsoft doc says “A double quotation mark preceded by a backslash (\“) is interpreted as a literal double quotation mark character (“).“, so I’m not sure I agree with the guy who closed the JDK bug.

borkdude18:06:11

I'm also confused by it, but I guess that's the reality

jkrasnay18:06:51

OK, thanks for your quick help!

borkdude19:06:59

@jkrasnay the alternative might be to not use quotes around the string in windows, surprisingly: https://blog.krecan.net/2008/02/09/processbuilder-and-quotes/

borkdude19:06:14

now I'm even more confused

jkrasnay19:06:09

I think my escapes were just escaping the quotes from the Clojure reader, so I’m not sure how to leave them out.

borkdude19:06:51

I'm going to run the tests on Windows CI for babashka.curl

borkdude19:06:44

@jkrasnay the current tests all pass on Windows: https://ci.appveyor.com/project/borkdude/babashka-curl/builds/33395135 now add a failing test...

jkrasnay22:06:57

I’ll give it a try in a bit