如何判断后端返回的是什么流

img


想问下大家,调接口后返回的内容如上图所示,这种属于是什么流?是返回的word文档流吗?

我估计你是想下载文件?

如果不是,这个回答请忽略

如果是axios的话,请求时,加个responseType可以试下:

{
        url: `xxxxxx`, 
        method: 'get',
        responseType: 'blob'
      }

得到Blob再处理一下,

const blob = new Blob([data.data], { type: type })
  const a = document.createElement('a')
  const href = window.URL.createObjectURL(blob)
  a.href = href
  a.download = fileName
  document.body.appendChild(a)
  a.click()
  document.body.removeChild(a)
  window.URL.revokeObjectURL(href)

你问问后端呗,可能给数据都加密了,如果是的话,问问他用什么加密的,然后你自己再解密就好了,数据是这样总不能你自己猜,那得猜到猴年马月,你问后端就行了

问一下后端😉