Commit f7a1178f authored by Antoor's avatar Antoor Committed by GitHub

Merge pull request #67 from antoor/v2.0-beta-request-timeout

v2.0-beta::request timeout setting
parents 533280f5 e22185d7
......@@ -106,7 +106,7 @@ class Request {
.proxy(APROXY_CONF['uri'])
.type('form')
// 超时
.timeout(REQ_TIMEOUT)
.timeout(opts.timeout || REQ_TIMEOUT)
// 忽略HTTPS
.ignoreHTTPS(opts['ignoreHTTPS'])
.send(_postData)
......
......@@ -240,6 +240,7 @@ class Base {
tag_e: opt['tag_e'],
encode: this.__opts__['encode'],
ignoreHTTPS: (this.__opts__['otherConf'] || {})['ignore-https'] === 1,
timeout: parseInt((this.__opts__['otherConf'] || {})['request-timeout']),
headers: (this.__opts__['httpConf'] || {})['headers'] || {},
body: (this.__opts__['httpConf'] || {})['body'] || {}
});
......
......@@ -41,6 +41,7 @@ class Form {
// 回调数据
if (callback) {
win.progressOn();
setTimeout(() => {
callback(this._parseFormData(
this.baseForm.getValues(),
this.httpForm.getValues(),
......@@ -54,6 +55,7 @@ class Form {
win.progressOff();
toastr.error(msg, LANG_T['error']);
});
}, 100);
};
});
}
......@@ -268,7 +270,8 @@ class Form {
_createOtherForm(arg) {
const opt = Object.assign({}, {
'ignore-https': 0,
'terminal-cache': 1
'terminal-cache': 1,
'request-timeout': '10000'
}, arg.otherConf);
const form = this.accordion.cells('other').attachForm([{
type: 'settings', position: 'label-right', inputWidth: 400
......@@ -280,7 +283,20 @@ class Form {
}, {
type: "checkbox", name: 'terminal-cache', label: LANG['list']['otherConf']['notermcache'],
checked: opt['terminal-cache'] === 1
}, {
type: "label", label: '请求超时'
}, {
type: "combo", label: '/ms', inputWidth: 100, name: "request-timeout", readonly: true, options: [
{
text: "5000", value: "5000", selected: opt['request-timeout'] === '5000'
}, {
text: "10000", value: "10000", selected: opt['request-timeout'] === '10000'
}, {
text: "30000", value: "30000", selected: opt['request-timeout'] === '30000'
}, {
text: "60000", value: "60000", selected: opt['request-timeout'] === '60000'
}
]},
]}], true);
return form;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment