admin管理员组文章数量:1425875
I have this POST request with axios in React :
postRunSimulation(simulationId) {
var requestAnalysis = `${configFile.web.backend}analysis/${simulationId}/run`;
return axios.post(requestAnalysis)
.then(function (response) {
return response.headers;
}, function(error) {
throw new Error('An error occurred : ' + error.status + ' - ' + error.statusText);
});
},
The object I get in return has a headers
property but it's empty. If I make the same call with Postman, I get the headers. What am I doing wrong ?
I have this POST request with axios in React :
postRunSimulation(simulationId) {
var requestAnalysis = `${configFile.web.backend}analysis/${simulationId}/run`;
return axios.post(requestAnalysis)
.then(function (response) {
return response.headers;
}, function(error) {
throw new Error('An error occurred : ' + error.status + ' - ' + error.statusText);
});
},
The object I get in return has a headers
property but it's empty. If I make the same call with Postman, I get the headers. What am I doing wrong ?
1 Answer
Reset to default 6If your back-end is running on a different host or port than the web app, the browser can only access the following 6 response headers by default: Cache-Control
, Content-Language
, Content-Type
, Expires
, Last-Modified
, and Pragma
(see also this answer). If the server does not return any of them, the headers
will be empty.
本文标签: javascriptCan39t get headers from Http POST request with AxiosStack Overflow
版权声明:本文标题:javascript - Can't get headers from Http POST request with Axios - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745373494a2655835.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论