Closed lzlv312 closed 2 years ago
已验证 1.3.8 : xhr库:CancelToken 正常执行了,且不会报错,json 的问题,在源码里面,我看text和json执行的是同一个判断,返回的是同一个值,并没有区别 fetch库:header 不设置不会卡请求了,但是CancelToken不工作,没有效果
当 Content-Type: application/json;charset=utf-8 时是不是有问题?被序列化了?
续上面,原来必须要手动设置 requestType: 'json',只设置请求头不行,这个和axios不一样。。。requestType和responseType在axios中默认都是json了
xhr 和 miniprogram 在 timeout 时会进入 catch,而fetch却不会?也没有code,那怎么判断呢。
已发布 1.3.10
对,我使用的就是 timeout 中间件,说的也是它,像这样
这个有问题吗?我的意思是 我测试 在 xhr 和 小程序 它是工作正常的,fetch 只是在控制台能看到 timeout 报错,但是并不会走 catch 。
如果没走 catch 肯定是有问题的。你把 timeout 和 errorRetry 换个位置试一下
试了,放在最后可以,,,
把 timeout 和 errorRetry 换个位置 是不行的
xhr库: 如果不设置 responseType 会显示警告 The provided value 'undefined' is not a valid enum value of type XMLHttpRequestResponseType. 如果设置了 responseType: 'json' 则返回结果仍是文本。 如果请求被CancelToken中断,则会报错 Uncaught TypeError: Cannot destructure property
responseText
of 'undefined' or 'null'.fetch库: config必须设置一个 header: {} ,才能设置 headers,否则会卡请求。
cache中间件:文档描述和测试用例不符,到底如何使用?