Initial logic to handle "X-Responded-JSON" header introduced in MVC 5

The security pipeline of OWIN and MVC 5 changed and now we can get header "X-Responded-JSON" with status code differ from the one declared in the headers section of the HTTP response.

For example, if we apply [Authorize] attribute to an API controller method then the response will have status code 200, but it will be "X-Responded-JSON"  header added to the response with content like this:
X-Responded-JSON: {"status":401,"headers":{"location":"http:\/\/somewebsite\/Account\/Login?ReturnUrl=%2Fbreeze%2FApi%2FRequest"}}

We see here that the real status code is 401 and we should call 'config.error(..)' method instead of 'config.success(..)'

I made changes for jQuery only and probably the same changes should be applied for Angular.js.