refactored fetch to handle multiple http status code