senchalabs/connect — pull request #720 by focusaurus (2013-01-06 00:31:53+00:00)
Title: text middleware, tests, and refactoring of json & urlencoded to make use of it

This provides a text middleware if you want to buffer the request body into req.body as a string. Some refactoring to make use of the shared code now. All existing tests pass without modification and new tests were added and pass. Should be 100% compatible with bodyParser (which does not use the text middleware directly), json, urlencoded, and formidable. Not sure if this is compelling or not, but it's handy for uploading markdown, for example. Seemed like good design to have one middleware handle the buffering and the other things that operate on non-streaming request bodies just make use of that. Should be easier to add more middleware that parses non-streaming text based request bodies either in connect itself or in other projects/libraries with this piece in place. I also have seen this asked for on stackoverflow. (http://stackoverflow.com/questions/12345166/how-to-force-parse-request-body-as-plain-text-instead-of-json-in-express for example)