With the following middleware:
use RC::ErrorHandler , lambda {|env| RuntimeError.new(env[RC::RESPONSE_BODY]['message']) }
use RC::ErrorDetector , lambda {|env| env[RC::RESPONSE_BODY]['status'] != 'ok'}
use RC::ErrorDetectorHttp
use RC::JsonResponse , true
and a request that returns a non-success http status code returning an html error page, JsonResponse can't parse the response.
Moving the JsonResponse middleware to before the ErrorHandler (not just ErrorDetectorHttp) solves this problem, but then the ErrorDetector and ErrorHandler can't be used because at that moment the body hasn't been parsed yet.
Any idea how to solve this nicely?
(Somewhat similar to #8.)
With the following middleware:
and a request that returns a non-success http status code returning an html error page, JsonResponse can't parse the response.
Moving the JsonResponse middleware to before the ErrorHandler (not just ErrorDetectorHttp) solves this problem, but then the ErrorDetector and ErrorHandler can't be used because at that moment the body hasn't been parsed yet.
Any idea how to solve this nicely?
(Somewhat similar to #8.)