我正在使用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>