Javascript:axios:批处理请求

San*_*idi 5 javascript batch-processing axios

如何使用axios进行批处理请求:

我有以下批量请求

POST /batch HTTP/1.1
Content-Type: multipart/mixed; boundary=====1340674896===

--====1340674896===

GET /contacts/479038 HTTP/1.1
Content-Type: application/json

--====1340674896===

GET /contacts/299430 HTTP/1.1
Content-Type: application/json

--====1340674896===--
Run Code Online (Sandbox Code Playgroud)

如何使用axios获得响应:我正在尝试以下

     const config = {
        headers: {
            'content-type': 'multipart/mixed; boundary=====1340674896==='
        }
     }
     axios.post('/batch',data,config)
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
Run Code Online (Sandbox Code Playgroud)

如何传递数据

    --====1340674896===

GET /contacts/479038 HTTP/1.1
Content-Type: application/json

--====1340674896===

GET /contacts/299430 HTTP/1.1
Content-Type: application/json

--====1340674896===--
Run Code Online (Sandbox Code Playgroud)