当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript IReply.continue方法代码示例

本文整理汇总了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()
  })
开发者ID:TechNottingham,项目名称:Hack24-API,代码行数:16,代码来源:override-response-type.ts

示例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 })
      })
开发者ID:TechNottingham,项目名称:Hack24-API,代码行数:17,代码来源:basic-auth-scheme.ts

示例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;
}
开发者ID:nozzlegear,项目名称:deliver-on,代码行数:39,代码来源:api-v1-routes.ts

示例4: options

export async function options(server: Server, request: Request, reply: IReply)
{
    return reply.continue();
}
开发者ID:nozzlegear,项目名称:deliver-on,代码行数:4,代码来源:api-v1-routes.ts


注:本文中的hapi.IReply.continue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。