Skip to content

Commit

Permalink
fix #194
Browse files Browse the repository at this point in the history
  • Loading branch information
wendux committed Mar 12, 2019
1 parent 13a813e commit fced928
Show file tree
Hide file tree
Showing 38 changed files with 228 additions and 230 deletions.
4 changes: 2 additions & 2 deletions dist/adapter/dsbridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function KEEP(_,cb){cb();}
"use strict";

var handleImgBase64Data = __webpack_require__(0);
var adapter;
var adapter = void 0;
if (window.dsBridge) {
adapter = function adapter(request, responseCallBack) {
dsBridge.call("onAjaxRequest", request, function (responseData) {
Expand All @@ -116,4 +116,4 @@ KEEP("cdn||cdn-min", function () {
module.exports = adapter;

/***/ })
/******/ ]);
/******/ ]);
2 changes: 1 addition & 1 deletion dist/adapter/dsbridge.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/engine-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function EngineWrapper(adapter) {
request.body = null;
}
self._changeReadyState(3);
var timer;
var timer = void 0;
self.timeout = self.timeout || 0;
if (self.timeout > 0) {
timer = setTimeout(function () {
Expand Down
2 changes: 1 addition & 1 deletion dist/engine-wrapper.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions dist/fly.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ var Fly = function () {
* @param [interceptor] either is interceptors.request or interceptors.response
*/
function wrap(interceptor) {
var resolve;
var reject;
var resolve = void 0;
var reject = void 0;

function _clear() {
interceptor.p = resolve = reject = null;
Expand Down Expand Up @@ -311,12 +311,12 @@ var Fly = function () {
}

var responseType = utils.trim(options.responseType || "");
var isGet = options.method === "GET";
var needQuery = ["GET", "HEAD", "DELETE", "OPTION"].indexOf(options.method) !== -1;
var dataType = utils.type(data);
var params = options.params || {};

// merge url params when the method is "GET" (data is object)
if (isGet && dataType === "object") {
if (needQuery && dataType === "object") {
params = utils.merge(data, params);
}
// encode params to String
Expand All @@ -328,7 +328,7 @@ var Fly = function () {
_params.push(params);
}
// Add data to url params when the method is "GET" (data is String)
if (isGet && data && dataType === "string") {
if (needQuery && data && dataType === "string") {
_params.push(data);
}

Expand Down Expand Up @@ -362,7 +362,7 @@ var Fly = function () {
data = JSON.stringify(data);
}
//If user doesn't set content-type, set default.
if (!(customContentType || isGet)) {
if (!(customContentType || needQuery)) {
options.headers[contentType] = _contentType;
}

Expand Down Expand Up @@ -435,16 +435,16 @@ var Fly = function () {
}
var status = engine.status;
var statusText = engine.statusText;
var data = {data: response, headers: headers, status: status, statusText: statusText};
var _data = {data: response, headers: headers, status: status, statusText: statusText};
// The _response filed of engine is set in adapter which be called in engine-wrapper.js
utils.merge(data, engine._response);
utils.merge(_data, engine._response);
if (status >= 200 && status < 300 || status === 304) {
data.engine = engine;
data.request = options;
onresult(responseInterceptor.handler, data, 0);
_data.engine = engine;
_data.request = options;
onresult(responseInterceptor.handler, _data, 0);
} else {
var e = new Err(statusText, status);
e.response = data;
e.response = _data;
onerror(e);
}
} catch (e) {
Expand All @@ -461,7 +461,7 @@ var Fly = function () {
};
engine._options = options;
setTimeout(function () {
engine.send(isGet ? null : data);
engine.send(needQuery ? null : data);
}, 0);
}

Expand Down
Loading

0 comments on commit fced928

Please sign in to comment.