add tests for RestAdapter

squashed commits:
* make request module injectable
* add test for RestAdapter
* test for passing through the error object
* test error-handling for invalid json responses
* remove unreachable OR branch
* improve test for isJSONResponse
* json property should not be set for different content types
* fix typo