[SOLVED] WebApp request raw body

I’m using Meteor 2.2, is there any way I can access the request raw body? I’m trying to work with Stripe and stuck at signature checking step.

I have managed it this way:

import { WebApp } from 'meteor/webapp'
import bodyParser from 'body-parser'

WebApp.connectHandlers.use((req, res, next) => {
  if (req.originalUrl === '/wh/stripe') {
    // Stripe requires the raw body to construct the event
    bodyParser.raw({ type: 'application/json' })(req, res, next)
  } else {
    bodyParser.json()(req, res, next)
  }
})
1 Like

Thank you, it works.
I found that my app uses bodyParser.json() in another place.

1 Like