planck

Planck ClojureScript REPL
2016-12-11T03:38:20.000043Z

@mfikes : I’d like to use planck to write a script to make some http calls to the rest api for datomic ( http://docs.datomic.com/rest.html ). Their api accepts "Content-Type: application/edn”. I tried using the {:content-type “application/edn”} with :form-params, but it doesn’t seem to work. Reading the source code, it looks like wrap-content-type will assoc the given header with the :headers key, but that wrap-form-params will clobber this by setting the :content-type to :form-urlencoded. Is that correct, and if so, is that an intentional design decision? If there’s no overriding interest in leaving it as is, I can write a pull request to leave the :form-urlencoded content-type as the default for form-params, but let the user override it with a provided :content-type value?

2016-12-11T03:39:31.000044Z

btw, I love planck! I managed to do the same task by using planck.shell to call curl , but it would be more fun being able to do it in planck.. 🙂

mfikes 2016-12-11T14:27:48.000045Z

@ghufran That sounds cool. Planck is currently marching towards a 2.0.0 release. Do you think it is possible to include something like this in master? In other words, for your purposes are you able to build and use Planck 2.0.0 betas for now?

mfikes 2016-12-11T14:30:02.000046Z

By the way, I think I’m going to set up a test HTTP server for Planck integration testing that essentially lets you do GETs, POSTs, etc, with it returning results as either edn or Transit, so that assertions can be made. That way, I can flesh out a good suite of integration tests for Planck’s HTTP functionality.

mfikes 2016-12-11T17:50:00.000047Z

I set up the above ^ so now Planck can do end-to-end tests of its HTTP stack against a dedicated server. https://github.com/mfikes/planck/commit/cf9cacce7c7fa02ed1ba16974de7a7fcd56a9a50

2016-12-11T19:15:56.000048Z

@mfikes : awesome! I’ll get working on it.. 🙂

mfikes 2016-12-11T19:16:05.000049Z

Cool!

mfikes 2016-12-11T19:16:38.000050Z

I’ve got a few more changes to commit to that test namespace @ghufran and then I’ll leave it alone to avoid any conflicts

mfikes 2016-12-11T19:30:09.000051Z

@ghufran All my changes have been pushed to Planck master. If you end up wanting to dynamically test changes to the Planck CLJS source, check out script/run which runs an instance of Planck with its own source in the classpath (that way you can make a change, and use (require … :reload) etc. And, if you tend to use an IDE, you can go into planck-cljs run lein repl and then (connect) to connect a conventional REPL to that instance of Planck via its socket REPL. Might be a little overhead for what you want to mess with, but if you end up wanting to cycle on changes, it is possible.

2016-12-11T19:38:49.000052Z

@mfikes : ok, I just pulled your changes. I’m currently trying to figure out how to run the tests, when I go to script/ and run ./test , I get the following message: -bash: ./test: planck-c/build/planck: bad interpreter: No such file or directory

mfikes 2016-12-11T19:40:14.000053Z

Ahh @ghufran script/test is intended to be run from the top-level

mfikes 2016-12-11T19:41:31.000054Z

And, if you don’t mind the longer cycle time, you can a) Make change to Planck’s source b) run script/build c) run the resulting Planck binary to see if it does what you want d) go to (a)

2016-12-11T19:44:25.000055Z

@mfikes : that didn’t seem to work either 😞 . `-bash: ./script/test: planck-c/build/planck: bad interpreter: No such file or directory ` I don’t actually see a build directory in plank-c/ . I have to go out for a bit, I’ll work on this some more this afternoon, thank you for all your help!

mfikes 2016-12-11T19:45:11.000056Z

OK. @ghufran problem is likely you need to run script/build first

2016-12-11T19:46:51.000057Z

Ah, thanks. (I have much to learn.... ) :)