senecajs / seneca-web-adapter-express

seneca-web adapter for express
MIT License
11 stars 14 forks source link

Omitting the `pass` redirect declaration in auth route will cause the request handling hang #9

Closed jacobbubu closed 8 years ago

jacobbubu commented 8 years ago
   login: {
      POST: true
      auth: {
          strategy: 'local',
          // pass: '/profile',
          fail: '/'
      }
    }

I've found that in the line https://github.com/senecajs/seneca-web-adapter-express/blob/master/seneca-web-adapter-express.js#L45 that try to read the body from the request stream, but the stream has already been read to close by Passport. The request.on('end') in read-body.js has never been fired.

tswaters commented 8 years ago

Does one of the passport strategies do it's own body parsing?

Typically you'll have body-parser in use on your express application and that is what is draining the request stream... passport (the local strategy, anyway, unsure on any others) only reads from body, it won't attempt to parse it.

You can fix this by passing {options: {parseBody: false}} to the seneca-web configuration. See https://github.com/senecajs/seneca-web#body-parser

jacobbubu commented 8 years ago

Thanks, I'll try this option.