如何在node.js中解析`multipart / mixed`?

时间:2019-05-30 10:24:45

标签: node.js multer formidable busboy

我在node.js中看到很多模块,例如busboy,multer,厉害,但它们无法解析multipart/mixed主体。

node.js中的请求multipart/mixed的示例

--batchbatch
Content-Type: multipart/mixed; boundary=changeset1

--changeset1
Content-Type: application/http
Content-Transfer-Encoding: binary

POST data HTTP/1.1
Content-Type: application/json
Content-ID: ID1
Content-Length: 10000

{
"Name": "ddd",
"data1": "3",
"data2": "40", 
"data3": "OPPT",
"data3":"D1000",
"dat4": "D1000"
}


--changeset1--

--batchbatch
Content-Type: multipart/mixed; boundary=changeset2

--changeset2
Content-Type: application/http
Content-Transfer-Encoding: binary

PATCH data/32451 HTTP/1.1
Content-Type: application/json
Content-ID: ID1
Content-Length: 10000

{
"code": "3"
}

--changeset2--
--batchbatch
Content-Type: multipart/mixed; boundary=changeset3

--changeset3
Content-Type: application/http
Content-Transfer-Encoding: binary

DELETE /data/2345 HTTP/1.1


--changeset3--
--batchbatch--

0 个答案:

没有答案