Javascript Safari中的Axios出现网络错误,而不是Chrome(Firefox的另一个问题)

Javascript Safari中的Axios出现网络错误,而不是Chrome(Firefox的另一个问题),javascript,google-chrome,firefox,safari,axios,Javascript,Google Chrome,Firefox,Safari,Axios,我的react应用程序中有以下Axios put请求。这是一个Spring存储资源 axios.put(journal._links.self.href, journal) .then(response => alert("Responded: " + JSON.stringify(response))) .catch((error)=> { if (error.response) { // The

我的react应用程序中有以下Axios put请求。这是一个Spring存储资源

  axios.put(journal._links.self.href, journal)
       .then(response => alert("Responded: " + JSON.stringify(response)))
       .catch((error)=> {
           if (error.response) {
               // The request was made and the server responded with a status code
               // that falls out of the range of 2xx
               alert('Data: ' + error.response.data);
               alert('Status: ' + error.response.status);
               alert('Headers: ' + error.response.headers);
           } else if (error.request) {
               // The request was made but no response was received
               // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
               // http.ClientRequest in node.js
               alert('Request: ' + JSON.stringify(error.request));
               alert('Error: ' + error.message);
           } else {
               // Something happened in setting up the request that triggered an Error
               alert('Error: ' + error.message);
           }
       })
在Chrome中,我得到了预期的“响应”响应。但在狩猎中,我得到了

Request: {}
Error: Network Error
在Firefox中,除了控制台显示外,根本不会生成警报框

NS_ERROR_XPC_SECURITY_MANAGER_VETO

关于如何追踪错误来源的任何想法显然,问题在于我使用

<button
    onClick={this.doSave}
>
   Save Changes
</button>

保存更改
这有一个默认类型
submit
,因此在Safari/Firefox试图提交表单时存在竞争条件。将
type=“button”
添加到
按钮
标记中解决了该问题,一切正常