Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
agent.Request.prototype.end = function(cb) {
var request = this;
request.emit('ngRequest');
agent.emit('request');
this._end(function(err, res) {
request.emit('ngEnd');
if(err) { agent.emit('error', err); }
agent.emit('end', request);
cb(err, res);
});
};
});
agent.Request.prototype.end = function(cb) {
var request = this;
request.emit('ngRequest');
agent.emit('request');
this._end(function(err, res) {
request.emit('ngEnd');
if(err) { agent.emit('error', err); }
agent.emit('end', request);
cb(err, res);
});
};
});
this.end(function(err, res) {
if(err) {
agent.emit('error', err);
err.method = request.method;
err.url = request.url;
err = $q.reject(err);
}
var resolution = requestProvider.resolvers.reduce(function(promise, resolvers) {
var success = resolvers[0] ? resolvers[0].bind(methods) : null;
var error = resolvers[1] ? resolvers[1].bind(methods) : null;
return promise.then(success, error);
}, err || $q.when(res));
deferred.resolve(resolution);
$scope.$apply();
});
this.end(function(err, res) {
if(err) {
agent.emit('error', err);
err.method = request.method;
err.url = request.url;
err = $q.reject(err);
}
var resolution = requestProvider.resolvers.reduce(function(promise, resolvers) {
var success = resolvers[0] ? resolvers[0].bind(methods) : null;
var error = resolvers[1] ? resolvers[1].bind(methods) : null;
return promise.then(success, error);
}, err || $q.when(res));
deferred.resolve(resolution);
$scope.$apply();
});
this._end(function(err, res) {
request.emit('ngEnd');
if(err) { agent.emit('error', err); }
agent.emit('end', request);
cb(err, res);
});
};
this._end(function(err, res) {
request.emit('ngEnd');
if(err) { agent.emit('error', err); }
agent.emit('end', request);
cb(err, res);
});
};