Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleware not working: body-parser body-parser-xml not returning a body #40

Open
musemega opened this issue Jun 3, 2016 · 0 comments

Comments

@musemega
Copy link

musemega commented Jun 3, 2016

This code does not return a body using meteor 1.3:

`Meteor.startup(function() {

Picker.route('/api/imports2', function(req, res, next) {
var _bodyParser = require('body-parser');
require('body-parser-xml')(_bodyParser);

Picker.middleware( _bodyParser.json() );
Picker.middleware( _bodyParser.urlencoded( { extended: false } ) );
Picker.middleware( _bodyParser.xml({
  explicitArray: false,
  normalize: false,
  normalizeTags: false,
  trim: true
}));

var _xml = req.body;

next();

});
});`

The route works, the middleware array gets populated correctly, but nothing is in the resultant req object except an empty query object.

Just to test, I created a pure node/express app, and the body-parser/body-parser-xml middleware works fine.

Here's a curl statement I'm using:
curl -X POST -H "Content-Type: application/xml" -H "Accept: application/xml" -d '<run><log encoding="hexBinary">4142430A</log><result>0</result><duration>2000</duration></run>' http://localhost:3010/imports

I must be missing something...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant