Closed jackyz closed 12 years ago
seems like it breaks the tests
I missed one line, fixed, the test will happy now.
I’d love for that to be improved as well :)
@jackyz: Here’s bodyParser
on GitHub: https://github.com/senchalabs/connect/blob/master/lib/middleware/bodyParser.js
@gasi: That isn't the latest version that Connect 1.8.0 use.
You can use npm install connect@1.8.0
to get v1.8.0, and check the bodyParser.js
in node_modules/connect/lib/middleware
dir.
there's a 1.x branch
no worries though if the tests pass now i can integrate that into master and backport
this lib is becoming a mess haha we'll have to document it better sometime but hey it works for now so i'll merge this
YES! You two are awesome, thanks :) You accepted this pull request in the same time I wrote a workaround ;) Please ping this thread once you’ve published the new qs
on npm, thanks.
already done :) just going to integrate with connect and update tests etc
Tried the new multipart parsing in bodyParser
and I love it. Unfortunately, existing code directly based on formidable
’s IncomingForm
parsing breaks since the multipart body has already been consumed by the new bodyParser
. Nothing you can do about it but might be useful to document as part of the new express
release.
http://tjholowaychuk.com/post/12943975936/connect-1-8-0-multipart-support
Unifies multipart, json, and x-www-form-urlencoded parsing in the bodyParser() middleware is exactlly what I want. But something is missing, still.
for example:
But it should be (keep same as x-www-form-urlencoded parsing does)
After a half-day hacking in the code. I found the nest-name parse was in the
qs
module. It shoud been reuse in multipart parsing process as well.so I refactor querystring.js(just move out functions etc.), make qs.parse can accept an object as input param.
After that, the bodyParser() middleware could reuse the nest-name parse logic in multipart, just like this:
BTW. I cannot find the latest version of bodyParser.js in github, so I just paste the code here.