dakrone/clj-http — Issue #28: Make request functions dynamic
Author: kokaku
Created: 2011-12-13 17:35:45+00:00
State: open

It'd be helpful if the get, head, post, put, delete functions in client.clj were marked ^:dynamic; in Clojure 1.3, variables need to be explicitly marked with ^:dynamic to be rebindable.

Using the clojure.core/binding macro to replace those functions allows using different HTTP libraries during testing. In this case, I have test code written to use clj-http, and I am also using [The Grinder](http://grinder.sourceforge.net/), a load testing tool that has its own instrumented HTTP library. Via rebinding, the same test code can be run from the REPL using clj-http when manual testing is needed and from The Grinder using its HTTP library when load testing is needed.

Currently, I need to write a ^:dynamic wrapper function around my clj-http calls to make this work. It'd be better if those functions could be rebound directly.