Javascript:axios:批处理请求

时间:2017-12-29 04:55:22

标签: 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===--

如何使用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);
      });

如何传递

的数据
    --====1340674896===

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

--====1340674896===

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

--====1340674896===--

0 个答案:

没有答案