提交 dff5003d 编写于 作者: L liuxiaohang

fix(h5、app): 1、修复H5、APP端,使用download-file时,timeout错误 2、APP端request统一默认值

上级 0b62d333
...@@ -20,8 +20,9 @@ const publishStateChange = (res) => { ...@@ -20,8 +20,9 @@ const publishStateChange = (res) => {
const createDownloadTaskById = function (downloadTaskId, { const createDownloadTaskById = function (downloadTaskId, {
url, url,
header, header,
timeout = __uniConfig.networkTimeout.downloadFile ? __uniConfig.networkTimeout.downloadFile / 1000 : 120 timeout
} = {}) { } = {}) {
timeout = (timeout || (__uniConfig.networkTimeout && __uniConfig.networkTimeout.request) || 60 * 1000) / 1000
const downloader = plus.downloader.createDownload(url, { const downloader = plus.downloader.createDownload(url, {
timeout, timeout,
filename: TEMP_PATH + '/download/', filename: TEMP_PATH + '/download/',
......
...@@ -46,7 +46,7 @@ export function createRequestTaskById (requestTaskId, { ...@@ -46,7 +46,7 @@ export function createRequestTaskById (requestTaskId, {
responseType, responseType,
sslVerify = true, sslVerify = true,
firstIpv4 = false, firstIpv4 = false,
timeout = __uniConfig.networkTimeout.request timeout = (__uniConfig.networkTimeout && __uniConfig.networkTimeout.request) || 60 * 1000
} = {}) { } = {}) {
const stream = requireNativePlugin('stream') const stream = requireNativePlugin('stream')
const headers = {} const headers = {}
......
...@@ -46,7 +46,7 @@ class DownloadTask { ...@@ -46,7 +46,7 @@ class DownloadTask {
export function downloadFile ({ export function downloadFile ({
url, url,
header, header,
timeout = (__uniConfig.networkTimeout && __uniConfig.networkTimeout.downloadFile) || 60 * 1000 timeout = (__uniConfig.networkTimeout && __uniConfig.networkTimeout.request) || 60 * 1000
}, callbackId) { }, callbackId) {
const { const {
invokeCallbackHandler: invoke invokeCallbackHandler: invoke
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册