batmanjs/batman — pull request #907 by kmcphillips (2013-11-22 15:42:43+00:00)
Title: Pass through responseText to error on Batman.Request

@pushrax @nsimmons
/cc @kristianpd @jbruton

## Problem

The format of the `response` object passed into the callback for `Batman.Request` calls is different for the success and failure cases. And that's fine. But the `assertGET` which delegates to `_assertXHR` does not include all the needed values into the response on error.

Consider: We are making a request to a JSON endpoint and expect JSON to come back even on a `422` or `402` for example. The real request returns the body as a `responseText` which we can then attempt to parse, but the mock response on error does not allow the `responseText` to be passed through.

## Solution

Pass through `responseText` to the `error` callback.

Tests added to cover this case and assert some of the existing behaviour.