小编Rui*_*edo的帖子

是否可以在 Strapi 上的定制端点上获取原始主体?

我正在 Strapi 上构建一个自定义端点。对于这个端点,我需要拥有原始正文内容。是否可以从变量中获取它ctx

stripe : async(ctx) => {
    // Handle the event
    const sig = ctx.request.headers['stripe-signature']
    
    let event = null
    try {
      // ctx.request.body needs to be the original raw body
      event = stripe.webhooks.constructEvent(ctx.request.body,sig, endpointSecret)
    }catch (e) {
      ctx.badRequest(null,e)
      return
    }
Run Code Online (Sandbox Code Playgroud)

strapi

7
推荐指数
2
解决办法
3056
查看次数

标签 统计

strapi ×1