我正在 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 ×1