Move out http response checking from the request

Refactoring the RestClient.

Change-Id: I0be5902cc120a076b6a9f18f9803404cb6a060cd