Return statusCode when resolving a promise