I'm developing Ember.js application that authenticates against OAuth2 endpoint.
In order to mock this endpoint, I use ember-cli-mirage
that needs to parse HTTP POST having content-type
of x-www-form-urlencoded
.
I decided to use body-parser
npm package in order to parse the body of the request.
Currently I have this code in my config.js
:
var urlencodedParser = BodyParser.urlencoded({ extended: false });
this.post('/login', (schema, request) => {
});
I know that request.requestBody
contains the data I'd like to parse, but I just can't find the correct way to make use of 'urlencodedParser` in order to parse this data.
Help will be appreciated.
Aucun commentaire:
Enregistrer un commentaire