okhttp response.body().contentLength()=-1

問題: 在使用okhttp下載文件的時候拿到的文件長度爲-1 解決思路 1.看服務器返回的請求頭是否含有Content-Length cmd 打開命令窗口輸入 curl -i +下載鏈接 窗口顯示 connect-length 是有數值的 2.看返回的content-type  content-type類型 https://www.runoob.com/http/http-content-type
相關文章
相關標籤/搜索