Add error cases

Add HTTP response error cases and its unit tests.