Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(response => {
switch (response.statusCode) {
// 202 - Thumbnail will be generated, but is not ready yet
// 302 - Thumbnail can not be generated
// return the url for a thumbnail placeholder
case httpStatusCodes.ACCEPTED:
case httpStatusCodes.FOUND:
return {
statusCode: response.statusCode,
location: response.headers.location
};
// 200 - Thumbnail image recieved
// return the thumbnail file
case httpStatusCodes.OK:
return {
statusCode: response.statusCode,
file: response.body
};
// Unexpected Response
default:
.on(SUCCESS, (user) => {
res
.status(Status.ACCEPTED)
.json(userSerializer.serialize(user));
})
.on(VALIDATION_ERROR, (error) => {
.on(SUCCESS, () => {
res.status(Status.ACCEPTED).end();
})
.on(NOT_FOUND, (error) => {