mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
tweaks and history
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
## v.NEXT
|
||||
|
||||
|
||||
### Utilities
|
||||
|
||||
* New `beforeSend` option to `HTTP.call` on the client allows you to directly
|
||||
access the `XMLHttpRequest` object and abort the call. #4419 #3243 #3266
|
||||
|
||||
|
||||
## in progress: v.1.1.1
|
||||
|
||||
### Blaze
|
||||
|
||||
* Preparatory work for the yet-unreleased `react-template-helper`
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* @param {Number} options.timeout Maximum time in milliseconds to wait for the request before failing. There is no timeout by default.
|
||||
* @param {Boolean} options.followRedirects If `true`, transparently follow HTTP redirects. Cannot be set to `false` on the client. Default `true`.
|
||||
* @param {Object} options.npmRequestOptions On the server, `HTTP.call` is implemented by using the [npm `request` module](https://www.npmjs.com/package/request). Any options in this object will be passed directly to the `request` invocation.
|
||||
* @param {Function} options.beforeSend On the Client, this will be called before the request is sent to allow for more granular ajax manipulation, `xhr` object is passed as the first argument, returning false within this callback will cancel the request.
|
||||
* @param {Function} options.beforeSend On the client, this will be called before the request is sent to allow for more direct manipulation of the underlying XMLHttpRequest object, which will be passed as the first argument. If the callback returns `false`, the request will be not be send.
|
||||
* @param {Function} [asyncCallback] Optional callback. If passed, the method runs asynchronously, instead of synchronously, and calls asyncCallback. On the client, this callback is required.
|
||||
*/
|
||||
HTTP.call = function(method, url, options, callback) {
|
||||
|
||||
@@ -454,20 +454,18 @@ testAsyncMulti("httpcall - npmRequestOptions", [
|
||||
}
|
||||
]);
|
||||
|
||||
testAsyncMulti("httpcall - beforeSend", [
|
||||
Meteor.isClient && testAsyncMulti("httpcall - beforeSend", [
|
||||
function (test, expect) {
|
||||
var fired = false;
|
||||
var bSend = function(xhr){
|
||||
test.isFalse(fired);
|
||||
fired = true;
|
||||
test.isTrue(temp1 instanceof XMLHttpRequest);
|
||||
test.isTrue(xhr instanceof XMLHttpRequest);
|
||||
};
|
||||
|
||||
if (Meteor.isClient) {
|
||||
HTTP.get(url_prefix() + "/", {beforeSend: bSend}, function () {
|
||||
test.isTrue(fired)
|
||||
});
|
||||
}
|
||||
HTTP.get(url_prefix() + "/", {beforeSend: bSend}, expect(function () {
|
||||
test.isTrue(fired);
|
||||
}));
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user