Permalink
Browse files

Process body on our own if not already there

  • Loading branch information...
1 parent 788fab6 commit eaffd02a02ec5fd22734338b0602be6ddba1335c @xrd committed Jan 13, 2011
Showing with 8 additions and 4 deletions.
  1. +7 −3 lib/connect-rpx.js
  2. +1 −1 package.json
View
@@ -43,12 +43,16 @@ function isAuthenticated(req) {
}
function getCredentials(req,res,next) {
- sys.puts( "About to decode body" );
- Connect.bodyDecoder()( req, res, function() { afterBodyParse( req, res, next ) } );
+ // If we have the body parsed already, use it, otherwise parse ourselves.
+ if( req.body ) {
+ afterBodyParse( req, res, next );
+ }
+ else {
+ require( 'connect' ).bodyDecoder()( req, res, function() { afterBodyParse( req, res, next ) } );
+ }
}
function afterBodyParse( req, res, next ) {
- sys.puts( "Decoded body" );
var token = req.body.token;
postWithCredentials( token, req, res, next );
}
View
@@ -1,4 +1,4 @@
{ "name" : "connect-rpx",
- "version" : "0.1.2",
+ "version" : "0.1.3",
"author" : "Chris Dawson <xrdawson@gmail.com>",
"main" : "./lib/connect-rpx" }

0 comments on commit eaffd02

Please sign in to comment.