【问题标题】:Corda /upload/attachment using fetch api gets correct response in network but throws errorCorda /upload/attachment 使用 fetch api 在网络中获得正确响应但抛出错误
【发布时间】:2019-06-03 04:28:22
【问题描述】:

我正在尝试将文档附加到我的节点。我在 React 中有以下代码。

const url = `http://localhost:10015/upload/attachment`;
const formData = new FormData();
formData.append('file',file); // from file select
let result = await fetch(url, {
  method: 'post',
  body: formData
});

当我查看网络日志时,似乎没有问题

响应是附件的哈希。

当我查看日志时,我有这个错误:

谁能帮我解决这个问题?

【问题讨论】:

    标签: fetch corda


    【解决方案1】:

    您的浏览器似乎根据其跨域资源共享 (CORS) 政策阻止了该请求。尝试在浏览器中禁用 CORS 或使用 Postman 等工具发出相同的请求,然后查看请求是否成功。

    【讨论】:

    • 但是有没有其他方法可以在服务器配置中禁用 CORS?我将 CORSFilter 添加为 @Provider 但这不起作用。
    猜你喜欢
    • 2021-08-21
    • 2019-10-03
    • 2015-12-19
    • 2017-03-17
    • 2021-04-19
    • 2014-03-27
    • 2022-10-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多