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
Merge pull request #308 from lusini/add-tests-for-restAdapter

Add tests for rest adapter