I'm using node-formidable for handling form data in Express/Nodejs app. I'm sending POST vars from POSTman Chrome Extension. (btw, http://httpbin.org/post works fine)
If i use multipart/form-data, everything is fine.
If i use urlencoded, form.parse's callback never triggers, and blocks all response. it simply locks the post method.
required:
var formidable = require('formidable');
var http = require('http');
var util = require('util');
post method:
app.post("/items",function(req,res){
var form = new formidable.IncomingForm();
form.parse(req,function(err,fields,files){
console.log(fields);
res.send("posted");
});
});
express settings:
app.use(express.json());
app.use(express.urlencoded());
app.use(express.multipart());
app.use(express.cookieParser());
app.use(express.static(__dirname + '/public'));
app.use(express.cookieSession({secret:"wow_so_secret_such_code_gud_layers"}));
app.use(passport.initialize());
app.use(passport.session());
app.use(express.methodOverride());
is there any trick for using urlencoded?
might be important;
{
domain: null,
_events: {},
_maxListeners: 10,
error: null,
ended: false,
maxFields: 1000,
maxFieldsSize: 2097152,
keepExtensions: false,
uploadDir: '/var/folders/pl/xnl7cxpj075chytyf_t7f1480000gn/T/',
encoding: 'utf-8',
headers: null,
type: null,
hash: false,
bytesReceived: null,
bytesExpected: null,
_parser: null,
_flushing: 0,
_fieldsSize: 0,
openedFiles: []
}
both urlencoded and multipart returns null.