开发工具中 wx.uploadFile 未遵循不校验证书设定
发布于 4 年前 作者 gang44 12403 次浏览 来自 问答

开发者工具设置了 不校验安全域名、TLS 版本以及 HTTPS 证书

wx.uploadFile 依然会报 uploadFile:fail Error: self signed certificate

5 回复

补充一下,目前好像只发现在上传文件跳不过校验,其他接口是可以用https://localhost:3000

最新版还是这样…

不管设置了不校验安全域名、TLS 版本以及 HTTPS 证书,

只要用了自签名证书, 上传文件都会返回错误

我也遇到这样的问题,本地开发用的是https://localhost,设置了不校验还是会报自签名证书错误

this.app.prefix = "https://localhost:3000"

this.wxapi

        .chooseImage({
          count: 1
        })
        .then(res => {
          let { tempFilePaths } = res;
          this.wxapi.showLoading({
            title: "图片上传中……"
          });
          this.wxapi.uploadFile({
            url: this.app.prefix + "/upload",
            filePath: tempFilePaths[0],
            name: "file" + new Date(),
          }).then((res) => {
              this.wxapi.hideLoading();
              let data = JSON.parse(res.data);
              this.setData({
                photoUrl: this.app.prefix + data.picture,
                picture: data.picture
              });
          })
        });

贴下域名

你好,请具体描述问题出现的流程,并提供能复现问题的截图,工具版本,以及简单代码示例。

回到顶部