【发布时间】:2018-03-01 16:54:55
【问题描述】:
JSON 响应按预期工作
axios.get('https://rallycoding.herokuapp.com/api/music_albums')
.then(response => console.log(response))
无法获得响应可能是因为它是 XML?
axios.get('http://thefederalistpapers.org/feed')
.then(response => console.log(response))
axios 是否可以获取 XML 提要?
这是我得到的错误:
可能的未处理承诺拒绝(id:0):
错误:网络错误
基本上我想要做的是,从 HTTP 请求中获取 XML,但我不知道如何将其转换为 JSON
我什至尝试过这个react-native-xml2js,但没有帮助,因为它不支持异步,不确定。
async (default false): 回调应该是异步的吗?这可能是一个 如果您的代码依赖于同步执行 回调。 xml2js 的未来版本可能会更改此默认值,因此 建议无论如何都不要依赖同步执行。添加于 0.2.6.
【问题讨论】:
标签: xml reactjs react-native axios