Connect compatibility issue (bodyParser)
devoidfury opened this issue · 1 comments
devoidfury commented
Start a fresh project; install latest connect and union.
index.js
var fs = require('fs'),
union = require('union'),
connect = require('connect');
var server = union.createServer({
before: [
connect.bodyParser(),
function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/html' })
res.end('<form action="" method="post"><input name=t><input type=submit></form>');
}
]
});
server.listen(9090);
Error when form is submitted:
_stream_readable.js:196
this._readableState.decoder = new StringDecoder(enc);
^
TypeError: Cannot set property 'decoder' of undefined
at Readable.setEncoding (_stream_readable.js:196:31)
at /test/node_modules/connect/lib/middleware/urlencoded.js:63:11
at noop (/test/node_modules/connect/lib/middleware/urlencoded.js:22:3)
at urlencoded (/test/node_modules/connect/lib/middleware/urlencoded.js:60:5)
at /test/node_modules/connect/lib/middleware/bodyParser.js:55:7
at json (/test/node_modules/connect/lib/middleware/json.js:56:55)
at Array.bodyParser [as 0] (/test/node_modules/connect/lib/middleware/bodyParser.js:53:5)
at dispatch (/test/node_modules/union/lib/routing-stream.js:110:21)
at RoutingStream.route (/test/node_modules/union/lib/routing-stream.js:121:5)
at g (events.js:175:14)
EDIT: tested with node v0.10.6, union v0.3.7, connect v2.7.11