Mini Program file download error

problem description

want to achieve the file download preview function in Mini Program, but always make mistakes, report 400s, not very familiar with this aspect, but also ask friends who know to help.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

 wx.downloadFile({
    url:path,   //
    success(res) {
     console.log(res);
      if (res.statusCode === 200) {
      const filePath = res.tempFilePath;
      wx.openDocument({
        filePath: filePath,
        success: function (res) {
          console.log("")
        }
      })
      }
    }, 
    fail: function (err) {
      console.log(err)
    }
    })

what result do you expect? What is the error message actually seen?

error message {statusCode: 400, errMsg: "downloadFile:ok"}

Oct.11,2021

same error. Very confused ~

Menu