req.body[參數名稱]拿到
若要接收raw data
@post "post/raw",(req,res,next)=>
data = ""
req.on 'data',(chunk)=>
data += chunk
req.on 'end', =>
req.rawBody = data
res.send(data)
若要當proxy模擬傳送raw data
可利用request來模擬client發送
設定的參數body內容為字串
request({
method: "POST"
uri: "test/post/paw",
body:"xxxxxx"
},function(err,httpResponse,body){
console.log "send raw resutl...."
}
)
沒有留言:
張貼留言