ng-jhipster
Version:
A Jhipster util library for Angular 2
26 lines (25 loc) • 1.02 kB
JavaScript
/**
* A HTTP interceptable responsibility chain member is a class, which may react on request and response of all requests
* done by HTTP.
*/
export var HttpInterceptable = (function () {
function HttpInterceptable() {
this._successor = null;
}
Object.defineProperty(HttpInterceptable.prototype, "successor", {
set: function (successor) {
this._successor = successor;
},
enumerable: true,
configurable: true
});
HttpInterceptable.prototype.processRequestInterception = function (options) {
return (!this._successor) ? this.requestIntercept(options) :
this._successor.processRequestInterception(this.requestIntercept(options));
};
HttpInterceptable.prototype.processResponseInterception = function (response) {
return (!this._successor) ? this.responseIntercept(response) :
this._successor.processResponseInterception(this.responseIntercept(response));
};
return HttpInterceptable;
}());