Fix Bug 885883 - Return JSON objects for API request fails rather than h...

...itting our error page when request in headers

https://bugzilla.mozilla.org/show_bug.cgi?id=885883