У меня проблемы с аутентификацией при переходе с httpreq на сообщение axios.Мне нужно использовать multipart / form-data.По некоторым причинам это не работает в axios, но это в httpreq.Чего мне не хватает?
httpreq:
postType1ToServer: function(request, callback) {
var options = {
headers: {
'Content-Type': 'multipart/form-data',
Connection: 'keep-alive',
Authorization: request.type1msg
},
agent: keepaliveAgent
};
return httpreq[request.method](request.options.url, options);
против axios
postType1ToServer: function(request, callback) {
var options = {
headers: {
'Content-Type': 'multipart/form-data',
Connection: 'keep-alive',
Authorization: request.type1msg
},
httpAgent: new http.Agent({ keepAlive: true })
};
return axios
.post(request.options.url, options)
.then(function(response) {
console.log(response);
})
.catch(function(response) {
console.log(response);
});