dakrone/clj-http — pull request #127 by tieTYT (2013-04-04 02:39:39+00:00)
Title: Potential fix for Issue 125

I've got a day's knowledge of Git/hub, and I've only been programming in Clojure for a couple of weeks, so I'm probably doing this wrong. But, maybe this will be somewhat helpful. This includes my fix.

I've added a new :client-param named :cookie-spec-factory. If you set this to a value, the add-client-params! function will register the factory and set the policy name to the name of the cookie spec factory class name. I felt this was a good way to ensure you don't register over another already registered factory. If you don't set the :cookie-spec-factory, it defaults to CookiePolicy/BROWSER_COMPATIBILITY for backwards compatibility.

Here's an example of how I used this new code:

(def easy-cookie-spec (proxy [BrowserCompatSpec] []
(validate [cookie origin] nil)))

(def cookie-spec-factory (proxy [CookieSpecFactory] []
(newInstance [params] easy-cookie-spec)))

(defn login [cookie-store]
(client/post "http://a.url.com" {:form-params { ;
}
:cookie-store cookie-store
:client-params {:cookie-spec-factory cookie-spec-factory}
}))