Improving error handling, and setting expected HTTP return code for responses to be Accepted