Fork me on GitHub
#planck
<
2016-12-11
>
ghufran03:12:20

@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?

ghufran03:12:31

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

mfikes14:12:48

@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?

mfikes14:12:02

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.

mfikes17:12:00

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

ghufran19:12:56

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

mfikes19:12:38

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

mfikes19:12:09

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

ghufran19:12:49

@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

mfikes19:12:14

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

mfikes19:12:31

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)

ghufran19:12:25

@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!

mfikes19:12:11

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

ghufran19:12:51

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