Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


express.bodyParser({intended for formidable}) not assigning listeners #565

rayie opened this Issue · 2 comments

2 participants


minor feature request
if opts contain keys matching formidable event names such as "progress" and "fileBegin", they are not added as listeners but just plain key/val pairs on form

bodyParser.js (line 157)

157   Object.keys(options).forEach(function(key){
158     form[key] = options[key];
159   });

Not finding any other hook to the formidable.IncomingForm object, exposed by express, so no other oppotunity to add listeners to it when using app.use(express.bodyParser({...})

Maybe change to this:

157   Object.keys(options).forEach(function(key){
158     if (typeof options[key]=="function" )
159         form.on(key, options[key]);
160     else form[key] = options[key];
161   });


tj commented

this was why I broke bodyParser into multipart(), json() and urlencoded(), so that if you want to use formidable directly you can just omit multipart(). In the near future (or now if you only care about modern browsers) you dont need the server for progress updates anyway, but it would be cleaner to omit multipart() and use formidable directly if you're using events


Sounds good. I'll do that. Thanks.

@rayie rayie closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.