如何获取没有标题

时间:2017-09-28 16:48:00

标签: node.js express

我正在使用app.use( bodyParser.text());从客户端检索文本字符串。虽然我从req.body获得了大量其他信息以及从客户端发送的字符串,例如content-type和其他与http头相关的内容。如何只获取客户端发送的“有效负载”数据而没有头信息?

这是一个例子: 当我打印req.body时,我得到:

------WebKitFormBoundarypOalQplbquvPou2o
Content-Disposition: form-data; name="file"; filename="index1.html"
Content-Type: text/html

<!DOCTYPE html>
<html>
<body>

<h1>Hello World</h1>

</body>
</html>
------WebKitFormBoundarypOalQplbquvPou2o--

我想要的只是我发送的HTML:

<!DOCTYPE html>
<html>
<body>

<h1>Hello World</h1>

</body>
</html>

0 个答案:

没有答案