added support for HTTP error statuses with JSON body