UNPKG

x-ng2-http-interceptor

Version:
50 lines 1.99 kB
import { Response } from '@angular/http'; import { InterceptorResponseWrapper } from './interceptor-response-wrapper'; import { InterceptorUtils } from './interceptor-utils'; /** * Utility builder for creating a new instance of InterceptorResponseWrapper * Use InterceptorResponseBuilder.new() to instantiate the builder */ export var InterceptorResponseWrapperBuilder = (function () { /** * Use InterceptorResponseBuilder.new() to instantiate the builder */ function InterceptorResponseWrapperBuilder() { } InterceptorResponseWrapperBuilder.new = function (response) { var builder = new InterceptorResponseWrapperBuilder(); if (response instanceof Response) { builder._response = response; } else if (response) { InterceptorUtils.assign(builder, response); } return builder; }; InterceptorResponseWrapperBuilder.prototype.response = function (response) { this._response = response; return this; }; InterceptorResponseWrapperBuilder.prototype.sharedData = function (sharedData) { this._sharedData = sharedData; return this; }; InterceptorResponseWrapperBuilder.prototype.forceReturnResponse = function (forceReturnResponse) { this._forceReturnResponse = forceReturnResponse; return this; }; InterceptorResponseWrapperBuilder.prototype.forceRequestCompletion = function (forceRequestCompletion) { this._forceRequestCompletion = forceRequestCompletion; return this; }; InterceptorResponseWrapperBuilder.prototype.err = function (err) { this._err = err; return this; }; InterceptorResponseWrapperBuilder.prototype.build = function () { this._sharedData = this._sharedData || {}; return new InterceptorResponseWrapper(this); }; return InterceptorResponseWrapperBuilder; }()); //# sourceMappingURL=interceptor-response-wrapper-builder.js.map