使用 superagent 进行设置
this.acceptContentType = "application/json";
req = Request.post(absoluteUrl)
.timeout(config.runtime.apiTimeoutMs)
.set('Accept', this.acceptContentType);
req.attach('files', file, file.name);
运行此程序时,我收到一条错误消息,指出 .on 不是函数。做了一些研究,似乎与 FormData() 对象有关。出于某种原因,superagent 将节点内部暴露给我的客户。这使用 Webpack 工作得很好,但是在移植到 Parcel 之后,它就坏了。任何指针将不胜感激。