Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function (err, res, body) {
common.logHttpResponse(res, 'CosmosDb - deleteCosmosDbAccount', true);
if (err) {
return callback(err);
}
if (res.statusCode != HttpStatus.ACCEPTED && res.statusCode != HttpStatus.NO_CONTENT) { // It returns status code 204 if the account is not existed
return common.formatErrorFromRes(res, callback);
}
callback(null, body);
}
);
function(err, response, body) {
common.logHttpResponse(response, util.format('%s - check resource group existence', prefix), true);
if(err) {
log.error('%s - check resource group existence, err: %j', prefix, err);
return callback(err);
}
// https://docs.microsoft.com/en-us/rest/api/resources/resourcegroups#ResourceGroups_CheckExistence
// 204 -> existed, 404 -> not existed
if (response.statusCode === HttpStatus.NO_CONTENT) {
log.info('%s - check resource group existence, succeeded: existed', prefix);
callback(null, true);
} else if (response.statusCode === HttpStatus.NOT_FOUND) {
log.info('%s - check resource group existence, succeeded: not existed', prefix);
callback(null, false);
} else {
log.error('%s - check resource group existence, err: %j', prefix, response.body);
return common.formatErrorFromRes(response, callback);
}
}
);
this.define(deleteTodo, context => {
this.todoService.remove(context.request.params.id);
context.response.statusCode = httpStatusCodes.NO_CONTENT;
});
}
it('should succeed to DELETE the new created user', async function () {
const response = await request(app)
.delete(`${baseApiUrlUnderTest}/${testUserId}`)
.set('Authorization', bearerToken);
expect(response.statusCode).to.equal(HttpStatus.NO_CONTENT);
});
msRestRequest.DELETE(that.serverUrl, headers, API_VERSIONS.MYSQL, function (err, res, body) {
if (err) {
log.error('client: deleteServer: err %j', err);
return callback(err, null);
}
common.logHttpResponse(res, 'Delete MySQL server', true);
if (res.statusCode === HttpStatus.NO_CONTENT) {
log.info('client: deleteServer: NO_CONTENT');
callback(null);
} else {
handleAsyncOperationRes(res, 'deleteServer', callback);
}
});
export function noContent(arg1: T | string | Wrapper, arg2?: string): T {
return answer(HTTP.NO_CONTENT, arg1, arg2);
}
cosmosDb.getCosmosDbAccount(resourceGroupName, cosmosDbAccountName, function(err, res, body) {
if (err) {
return callback(err);
}
if (res.statusCode != HttpStatus.NOT_FOUND && res.statusCode != HttpStatus.NO_CONTENT) {
var error = new Error('The cosmosDb account name is not available.');
error.statusCode = HttpStatus.CONFLICT;
return callback(error);
}
callback(null);
});
},
req.on('end', function(){
if (!/(.*)<\/samlp:SessionIndex>/.exec(body)) {
next();
return;
}
var st = RegExp.$1;
req.sessionStore.get(st, function(err, result){
if (result && result.sid) req.sessionStore.destroy(result.sid);
req.sessionStore.destroy(st);
});
res.send(HttpStatus.NO_CONTENT);
});
}
query = async (request, reply) => {
await this.model.destroy({
where: {
[this.model.primaryKeyField]: request.params.id,
},
});
return reply().code(HttpStatus.NO_CONTENT);
}
}