如何在多方中记录正文

时间:2016-09-26 10:47:26

标签: node.js express multipart

我正在使用node-multiparty,如何记录POST请求的正文?

app.post("/submit", function(httpRequest, httpResponse, next){

    var form = new multiparty.Form();

    form.on("part", function(part){
        if(part.filename)
        {
            var FormData = require("form-data");
            var request = require("request")
            var form = new FormData();

            form.append("thumbnail", part, {filename: part.filename,contentType: part["content-type"]});

            var r = request.post("http://localhost:7070/store", { "headers": {"transfer-encoding": "chunked"} }, function(err, res, body){ 
                httpResponse.send(res);
            });

            r._form = form
        }
    })

    form.on("error", function(error){
        console.log(error);
    })

    form.parse(httpRequest);    

});

0 个答案:

没有答案