myfreeweb/clj-http-fake — pull request #2 by tobyclemson (2012-03-21 14:24:47+00:00)
Title: Fix defaults bug

Hi,

I found a few bugs in clj-http-fake and this pull request addresses them. The issues I was having are as follows:

* clj-http 0.3.3 made a number of changes to the request map including using keywords for the scheme and using nil for the server-port rather than 80 when no port is specified. This pull request fixes the implementation to cope with this and works across all versions of clj-http from 0.2.3 onwards.
* The implementation of defaulting to port 80 and a scheme of http didn't seem to work consistently so now this defaulting works in both directions. I've also added defaulting for the uri.
* The regex construction from a string route didn't quote the string so the resulting regex was too permissive.

In order to maintain backwards compatibility with the older clj-http versions, I've changed the matching logic quite significantly. Now, a regular expression is constructed if not provided and all alternative requests for a given request are generated and tested against that regex. If one matches, that route is used to handle the request.

I also upgraded to leiningen 2 and Clojure 1.3 in the process. Let me know if there's anything you'd like changed.

Your feedback is welcome,
Thanks,
Toby