gopeed icon indicating copy to clipboard operation
gopeed copied to clipboard

[BUG][插件扩展] superagent 无法正常工作

Open foxxorcat opened this issue 1 year ago • 5 comments

Description(required)

  1. 实现的XMLHttpRequest中的getResponseHeader方法有误,搜索的报文名应该不区分大小写。 go默认是大写开头,superagent用的是全小写。(使用axios时设置cookie头会报错可能是这个问题???
  2. 只实现 globalThis ,但superagent使用的是window或self。(这个问题应该是superagent的???

暂时解决方法

  1. 指定 getXHR
superagent.getXHR = () => new XMLHttpRequest()

App Version(required)

1.5.7

foxxorcat avatar Jun 11 '24 03:06 foxxorcat

无法正常工作的具体表现是怎么样的呢

monkeyWie avatar Jun 11 '24 04:06 monkeyWie

superagent 自带的解析会根据content-type来执行,因为这个问题无法获取到content-type,导致自动解析不会执行,此时body == null,后续对body的操作全部报错。

foxxorcat avatar Jun 11 '24 04:06 foxxorcat

懂了,这块请求头和响应头处理确实有问题,有兴趣来个pr修复下吗

monkeyWie avatar Jun 11 '24 06:06 monkeyWie

这个是小问题,就不pr了。安装环境也是费点时间的。。。

foxxorcat avatar Jun 11 '24 06:06 foxxorcat

嗯,等我有空搞下,感谢反馈!

monkeyWie avatar Jun 11 '24 06:06 monkeyWie