Search code examples
iron-router

RESTFUL API : new Iron Router version this.request.body not working anymore


I had my API fully functional and everything was working like a charm but with the last updates of Iron Router (Meteor update could impact?) my command

this.request.body

doesn't render nothing when I have a POST call on my API (all calls work good and I have no problem with GET this.params), I took a look at the docs and I don't see nothing talking about this, does anyone have an idea?

Thanks for your help =)

PS : I tried to replace it (without success obviously) by : this.params.query.body this.request.query.body When I try to do a JSON.stringify on this.request it is empty so I guess it has been moved somewhere...


Solution

  • As asked here https://github.com/EventedMind/iron-router/issues/1003, just add:

    Router.onBeforeAction(Iron.Router.bodyParser.urlencoded({extended: false}))

    in your Meteor.startup