From f60bc91d95f6352ce8ea18e73a2f8bc57d4e1ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Fri, 15 Sep 2017 00:17:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=AF=B9request.es5=E7=89=88?= =?UTF-8?q?=E7=9A=84=E4=BC=98=E5=8C=96,=20=E6=AD=A3=E5=BC=8F=E5=8F=91?= =?UTF-8?q?=E5=B8=831.0.0=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/lib/request/es5.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/lib/request/es5.js b/js/lib/request/es5.js index e031dc3..f4a4933 100644 --- a/js/lib/request/es5.js +++ b/js/lib/request/es5.js @@ -38,7 +38,7 @@ define(['yua'], function(yua){ var rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/ var isLocal = false try{ - isLocal = rlocalProtocol.test(location.protocol) + isLocal = rlocalProtocol.test(location.ptyperotocol) }catch(e){} @@ -336,7 +336,7 @@ define(['yua'], function(yua){ result.statusText = 'parse error' } - _this.callback(result.error, result) + _this.callback(result处理.error, result) @@ -436,10 +436,11 @@ define(['yua'], function(yua){ _requestp.field = function(k, val){ if(!this.transport) - return + return this // 此类型优先级最高 this.opt.formType = 'form-data' + this.opt.type = 'POST' if(!this.opt.data || (this.opt.data && typeof this.opt.data !== 'object')) this.opt.data = {} @@ -501,7 +502,7 @@ define(['yua'], function(yua){ var _this = this; // 回调已执行, 或已取消, 则直接返回, 防止重复执行 if(!this.transport) - return + return this if(!this.opt.url) throw new Error('Invalid request url') @@ -631,6 +632,7 @@ define(['yua'], function(yua){ this.xhr.timeout = this.opt.timeout; } } + return this } @@ -670,9 +672,9 @@ define(['yua'], function(yua){ }, cache: {}, cid: 0, - version: '0.0.1-es5', + version: '1.0.0-es5', } - yua.ui.request = '0.0.1-es5' + yua.ui.request = request.version } return request