Correctly read body of server response in case of error. Previously,
null bytes were written to log.