http-kit/http-kit — pull request #89 by jaley (2013-10-18 12:47:44+00:00)
Title: Allow callback function to be a multimethod in HTTP requests

The `fn?` predicate returns `false` when passed a multimethod, meaning you get a slightly unhelpful `ClassCastException` if you try it with the current API, as it hits the branch that expects that arg to be a collection of some type instead. Mutlimethods are pretty useful as callback functions, as you can dispatch on the status code to handle different error conditions, which is very cool!

Ideally, the fix would've just been to use `ifn?` instead of `fn?`, but that predicate actually also returns `true` for vectors and maps, which breaks a load of tests. Instead, I explicitly added a case for `clojure.lang.MultiFn`, which seems to work OK.