React-Native 响应 headers 没有分开
React-Native response headers are not being separated
我正在尝试从提取 post 请求中获得响应 header。然而,它把几个 header 混在一起。
React Native 代码
fetch(...).then((response) => {
console.log(response.headers);
回应
{ date: [ 'Tue, 10 Jan 2017 20:21:54 GMT\nServer: Werkzeug/0.11.15 Python/3.6.0\ntoken: LrPyaQGfL2egGz521TDMUQ==\nContent-Length: 10\nContent-Type: text/html; charset=utf-8' ],'content-type': [ 'text/plain;charset=UTF-8' ] } }
此代码之前有效,但我在一台新笔记本电脑上设置了我的环境,突然之间发生了这种情况。
我已经用 fiddler 验证了 http 响应中有 crlf 字符。
这是 whatwg-fetch 处理程序 headers 方式中的一个问题。它已在 whatwg-fetch 版本 1.1.0 及更高版本中得到解决。这是一个react使用的库。
为了解决这个问题,我必须更新到 react-native 版本 0.39 和 运行 npm update。
这是 github 上的一个问题,其中讨论了我发现的问题。
我正在尝试从提取 post 请求中获得响应 header。然而,它把几个 header 混在一起。
React Native 代码
fetch(...).then((response) => {
console.log(response.headers);
回应
{ date: [ 'Tue, 10 Jan 2017 20:21:54 GMT\nServer: Werkzeug/0.11.15 Python/3.6.0\ntoken: LrPyaQGfL2egGz521TDMUQ==\nContent-Length: 10\nContent-Type: text/html; charset=utf-8' ],'content-type': [ 'text/plain;charset=UTF-8' ] } }
此代码之前有效,但我在一台新笔记本电脑上设置了我的环境,突然之间发生了这种情况。
我已经用 fiddler 验证了 http 响应中有 crlf 字符。
这是 whatwg-fetch 处理程序 headers 方式中的一个问题。它已在 whatwg-fetch 版本 1.1.0 及更高版本中得到解决。这是一个react使用的库。
为了解决这个问题,我必须更新到 react-native 版本 0.39 和 运行 npm update。
这是 github 上的一个问题,其中讨论了我发现的问题。