There are a couple of ways to handle non-200 responses. The first is to use `Http#x`, which doesn't check status codes at all. The trick is that you still want to use a `Handler`, usually, but `Handler` doesn't give access to status codes. So:
"throw status code exception when applied to non-existent resource" in {
http (test / "do_not_want" as_str) must throwA[StatusCode]
}
"allow any status code with x" in {
http x (test / "do_not_want" as_str) {
case (404, _, _, out) => out()
case _ => "success is failure"
} must include ("404 Not Found")
}
http://databinder.net/sxr/dispatch-http/0.7.3/test/HttpSpec.scala.html#15332Alternatively, if you still want some status codes to throw exceptions you can use `when` to specify particular codes as acceptable. That is, you can redefine the standard `Http#apply` method:
final def apply[T](hand: Handler[T]) = (this when {code => (200 to 204) contains code})(hand)
http://databinder.net/sxr/dispatch-http/0.7.3/main/Http.scala.html#8698to accept 500 responses as well. Then, you would use it the same as with `Http#x` above.
Nathan