本文整理汇总了TypeScript中hapi.IReply.continue方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IReply.continue方法的具体用法?TypeScript IReply.continue怎么用?TypeScript IReply.continue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hapi.IReply
的用法示例。
在下文中一共展示了IReply.continue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: applyEmptyStatusCode
server.ext('onPreResponse', (request: Request, reply: IReply) => {
applyEmptyStatusCode(request)
const response = request.response
if (response.isBoom) {
handleBoom(response, contentType)
} else {
// set content type if not already set
if (response.statusCode !== 204 && typeof response.headers['content-type'] === 'undefined') {
response.headers['content-type'] = contentType
}
}
reply.continue()
})
示例2: validateFunc
validateFunc(request, username, password, (err, isValid, credentials) => {
credentials = credentials || null
if (err) {
return reply(err, null, { credentials: credentials })
}
if (!isValid) {
return reply(Boom.unauthorized('Bad username or password', 'Basic', { realm }))
}
if (!credentials || typeof credentials !== 'object') {
return reply(Boom.badImplementation('Bad credentials object received for Basic auth validation'))
}
return reply.continue({ credentials: credentials })
})
示例3: updateAppConfig
export async function updateAppConfig(server: Server, request: Request, reply: IReply)
{
const validation = joi.validate<DeliverSettings>(request.payload, Validation.UpdateAppConfig)
if (validation.error)
{
return reply(Boom.badData(humanizeError(validation.error), validation.error));
}
const payload = validation.value;
let user: User;
try
{
user = await Users.get<User>(request.auth.credentials.userId);
}
catch (e)
{
console.error("Failed to retrieve user from database.", e);
return reply(Boom.wrap(e));
}
user.appConfig = payload;
const update = await Users.put(user);
if (!update.ok)
{
console.error("Failed to update user's app config.", update);
return reply(Boom.expectationFailed("Failed to update user's app config."));
}
// Bust the cache so users on the shop see this change immediately.
await setCacheValue(Caches.shopTagConfig, user.shopifyShopId.toString(), user.appConfig);
return reply.continue() as any;
}
示例4: options
export async function options(server: Server, request: Request, reply: IReply)
{
return reply.continue();
}