我正在做一个节点项目。在下面的中间件片段中,我需要从中删除换行符,req.body
以准备将其发送到 JSONP 响应中。
server.use(function(req,res,next){
if(req.query.concat) {
req.body = req.body; // <--- HERE I need to remove the newlines, etc.
} else {
req.body = req.body || {};
req.body.jsonp_callback = req.query.callback;
}
next();
})
如何让 req.body 为 JSONP 做好准备?