Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion dist/corbel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1508,6 +1508,7 @@
method: options.method || request.method.GET,
url: options.url,
headers: typeof options.headers === 'object' ? options.headers : {},
callbackExtras: options.extras,
callbackSuccess: options.success && typeof options.success === 'function' ? options.success : undefined,
callbackError: options.error && typeof options.error === 'function' ? options.error : undefined,
responseType: options.responseType,
Expand Down Expand Up @@ -1796,13 +1797,22 @@

}.bind(this);

if (params.callbackExtras) {
if (params.callbackExtras.requestCallback) {
params.callbackExtras.requestCallback(httpReq);
}
if (params.callbackExtras.progressCallback) {
httpReq.upload.onprogress = params.callbackExtras.progressCallback;
}
}

if (params.data) {
httpReq.send(params.data);
} else {
//IE fix, send nothing (not null or undefined)
httpReq.send();
}

};

return request;
Expand Down Expand Up @@ -2048,7 +2058,7 @@

params = this._addAuthorization(params);

return corbel.utils.pick(params, ['url', 'dataType', 'contentType', 'method', 'headers', 'data', 'dataFilter', 'responseType', 'withCredentials', 'success', 'error']);
return corbel.utils.pick(params, ['url', 'dataType', 'contentType', 'method', 'headers', 'data', 'dataFilter', 'responseType', 'withCredentials', 'success', 'error', 'extras']);
},

/**
Expand Down
6 changes: 3 additions & 3 deletions dist/corbel.min.js

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion dist/corbel.with-polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -2504,6 +2504,7 @@
method: options.method || request.method.GET,
url: options.url,
headers: typeof options.headers === 'object' ? options.headers : {},
callbackExtras: options.extras,
callbackSuccess: options.success && typeof options.success === 'function' ? options.success : undefined,
callbackError: options.error && typeof options.error === 'function' ? options.error : undefined,
responseType: options.responseType,
Expand Down Expand Up @@ -2792,13 +2793,22 @@

}.bind(this);

if (params.callbackExtras) {
if (params.callbackExtras.requestCallback) {
params.callbackExtras.requestCallback(httpReq);
}
if (params.callbackExtras.progressCallback) {
httpReq.upload.onprogress = params.callbackExtras.progressCallback;
}
}

if (params.data) {
httpReq.send(params.data);
} else {
//IE fix, send nothing (not null or undefined)
httpReq.send();
}

};

return request;
Expand Down Expand Up @@ -3044,7 +3054,7 @@

params = this._addAuthorization(params);

return corbel.utils.pick(params, ['url', 'dataType', 'contentType', 'method', 'headers', 'data', 'dataFilter', 'responseType', 'withCredentials', 'success', 'error']);
return corbel.utils.pick(params, ['url', 'dataType', 'contentType', 'method', 'headers', 'data', 'dataFilter', 'responseType', 'withCredentials', 'success', 'error', 'extras']);
},

/**
Expand Down
14 changes: 12 additions & 2 deletions src/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
throw new Error('undefined:url');
}

if (typeof(options.url) !== 'string') {
if (typeof (options.url) !== 'string') {
throw new Error('invalid:url', options.url);
}

Expand All @@ -230,6 +230,7 @@
method: options.method || request.method.GET,
url: options.url,
headers: typeof options.headers === 'object' ? options.headers : {},
callbackExtras: options.extras,
callbackSuccess: options.success && typeof options.success === 'function' ? options.success : undefined,
callbackError: options.error && typeof options.error === 'function' ? options.error : undefined,
responseType: options.responseType,
Expand Down Expand Up @@ -430,7 +431,7 @@
* @return {Boolean}
*/
request.isCrossDomain = function (url) {
if (url && typeof(url) === 'string' && url.indexOf('http') !== -1) {
if (url && typeof (url) === 'string' && url.indexOf('http') !== -1) {
return true;
} else {
return false;
Expand Down Expand Up @@ -518,13 +519,22 @@

}.bind(this);

if (params.callbackExtras) {
if (params.callbackExtras.requestCallback) {
params.callbackExtras.requestCallback(httpReq);
}
if (params.callbackExtras.progressCallback) {
httpReq.upload.onprogress = params.callbackExtras.progressCallback;
}
}

if (params.data) {
httpReq.send(params.data);
} else {
//IE fix, send nothing (not null or undefined)
httpReq.send();
}

};

return request;
Expand Down
2 changes: 1 addition & 1 deletion src/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@

params = this._addAuthorization(params);

return corbel.utils.pick(params, ['url', 'dataType', 'contentType', 'method', 'headers', 'data', 'dataFilter', 'responseType', 'withCredentials', 'success', 'error']);
return corbel.utils.pick(params, ['url', 'dataType', 'contentType', 'method', 'headers', 'data', 'dataFilter', 'responseType', 'withCredentials', 'success', 'error', 'extras']);
},

/**
Expand Down