Fix bug in REST client

Enhanced a little REST client unit tests
Removed unexisting reference
Merge pull request #1581 from Zentyal/ejhernandez/fix-rest-client

Fix REST client on error