Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(function (res) {
expect(res).to.be.json;
expect(res).to.have.status(HttpStatus.CREATED);
expect(res.body.id).to.not.be.empty;
// Store cart id
cartId = res.body.id;
});
});
databaseLogin,
databaseLoginPassword,
fqdn.replace(/.+\.database/, '*.database.secure'));
var uri = util.format('mssql://%s:%s@%s:1433/%s?encrypt=true&TrustServerCertificate=false&HostNameInCertificate=%s',
encodedLogin,
encodedLoginPassword,
fqdn,
sqldbName,
fqdn.replace(/.+\.database/, '%2A.database')
);
// contents of reply.value winds up in VCAP_SERVICES
var reply = {
statusCode: HttpStatus.CREATED,
code: HttpStatus.getStatusText(HttpStatus.CREATED),
value: {
credentials: {
sqldbName: sqldbName,
sqlServerName: sqlServerName,
sqlServerFullyQualifiedDomainName: fqdn,
databaseLogin: databaseLogin,
databaseLoginPassword: databaseLoginPassword,
jdbcUrl: jdbcUrl,
jdbcUrlForAuditingEnabled: jdbcUrlForAuditingEnabled,
hostname: fqdn,
port: 1433,
name: sqldbName,
username: databaseLogin,
password: databaseLoginPassword,
uri: uri
}
.then((response) => {
if (response.status !== HttpStatus.CREATED) return Promise.reject(response);
const {
roomName: createdRoomName, roomSecret, passwordEnabled, roomAccessToken,
} = response.data;
// its called createdRoomName because some minor changes may be done to
// the name sent by the client above.
// store secret in localStorage
dispatch({
type: CREATE_ROOM,
payload: { createdRoomName },
});
if (passwordEnabled) {
dispatch(storeRoomAccessToken(createdRoomName, roomAccessToken));
} else {
dispatch(storeRoomSecret(createdRoomName, roomSecret));
cp.bind(redisClient, function(err, credentials) {
if (err) {
common.handleServiceError(err, next);
} else {
// contents of reply.value winds up in VCAP_SERVICES
var reply = {
statusCode: HttpStatus.CREATED,
code: HttpStatus.getStatusText(HttpStatus.CREATED),
value: {
credentials: credentials
}
};
next(null, reply, {});
}
});
};
it('succeed on CREATED return code', function (done) {
var cp = new cmdPoll(afterProvisionValidParamsWithTDE);
var tdeResult = {
statusCode:HttpStatus.CREATED,
body:{
message:'success'
}
};
msRestRequest.PUT.withArgs('https://management.azure.com//subscriptions/55555555-4444-3333-2222-111111111111/resourceGroups/sqldbResourceGroup/providers/Microsoft.Sql/servers/golive4/databases/sqldb/transparentDataEncryption/current')
.yields(null, tdeResult, tdeResult.body);
cp.poll(sqldbOps, function (err, result) {
should.not.exist(err);
result.statusCode.should.equal(HttpStatus.OK);
result.value.state.should.equal('succeeded');
done();
});
});
});
}
const userData = new User({
userId: request.params.userId,
searches: request.body.searches,
readLater: request.body.readLater,
likes: request.body.likes,
watchedTags: request.body.watchedTags,
pinned: request.body.pinned,
favorites: request.body.favorites,
history: request.body.history
});
const newUserData = await userData.save();
response.status(HttpStatus.CREATED).send(newUserData);
} catch (err) {
return response
.status(HttpStatus.INTERNAL_SERVER_ERROR)
.send(err);
}
});
private createUserCommand: RouteCommand = async routeContext => {
const userModel = routeContext.getValidatedRequestBody(validateCreateUserBody);
/**
* Here we need to manually set undefined values by default because if those fields
* aren't set, pg-promise is going to complain with a `Property ${property} doesn't exist` error.
*/
const userParams: CreateUser = {
enabled: true,
...userModel,
};
const newUser = await this.manager.create(userParams);
return {
data: newUser,
status: HttpStatus.CREATED,
};
}
function (err, res, body) {
common.logHttpResponse(res, 'RedisCache - createRedis', false);
if (err) {
return callback(err);
}
if (res.statusCode != HttpStatus.CREATED && res.statusCode != HttpStatus.OK) {
return common.formatErrorFromRes(res, callback);
}
callback(null, body.properties);
}
);
//noinspection Annotator
let res = joi.validate(ctx.request.body, schema);
if (null === res.error) {
let user = await findUserByEmail(res.value.email);
if (0 >= user.length) {
try {
let recordObject = await createRecordObject(res.value);
await saveUser(recordObject);
let tokenObject = await generateTokenObject(res.value);
ctx.response.status = HttpStatus.CREATED;
ctx.body = {
status: HttpStatus.CREATED,
message: {
expires_in: tokenObject.expires_in,
token: tokenObject.token
}
};
} catch (err) {
throw new ApiAccessBoundleError(
HttpStatus.SERVICE_UNAVAILABLE, err);
}
} else {
throw new ApiAccessBoundleError(
HttpStatus.CONFLICT, 'The user already exist');
}
} else {
throw new ApiAccessBoundleError(
HttpStatus.BAD_REQUEST, res.error.message);
private searchEventReceiversCommand: RouteCommand = async routeContext => {
const eventModel = routeContext.getRequestBody() as Event;
const { saveEvent } = routeContext.getQueryParams() as { saveEvent: string };
const shouldSaveEvent = saveEvent === 'true';
const receivers: EventReceiversResult = await this.manager.searchReceiversByRecord(eventModel, shouldSaveEvent);
return {
data: receivers.userContactList,
status: shouldSaveEvent ? HttpStatus.CREATED : HttpStatus.OK,
};
}