HttpInterceptors class
A list of HttpInterceptors.
class HttpInterceptors { List<HttpInterceptor> _interceptors = [new DefaultTransformDataHttpInterceptor()]; add(HttpInterceptor x) => _interceptors.add(x); addAll(List<HttpInterceptor> x) => _interceptors.addAll(x); /** * Called from [Http] to construct a [Future] chain. */ constructChain(List chain) { _interceptors.reversed.forEach((HttpInterceptor i) { // AngularJS has an optimization of not including null interceptors. chain.insert(0, [ i.request == null ? (x) => x : i.request, i.requestError]); chain.add([ i.response == null ? (x) => x : i.response, i.responseError]); }); } /** * Default constructor. */ HttpInterceptors() { _interceptors = [new DefaultTransformDataHttpInterceptor()]; } /** * Creates a [HttpInterceptors] from a [List]. Does not include the default interceptors. */ HttpInterceptors.of([List interceptors]) { _interceptors = interceptors; } }
Constructors
new HttpInterceptors() #
Default constructor.
HttpInterceptors() { _interceptors = [new DefaultTransformDataHttpInterceptor()]; }
new HttpInterceptors.of([List interceptors]) #
Creates a HttpInterceptors from a List. Does not include the default interceptors.
HttpInterceptors.of([List interceptors]) { _interceptors = interceptors; }
Methods
dynamic add(HttpInterceptor x) #
add(HttpInterceptor x) => _interceptors.add(x);
dynamic addAll(List<HttpInterceptor> x) #
addAll(List<HttpInterceptor> x) => _interceptors.addAll(x);
dynamic constructChain(List chain) #
Called from Http to construct a Future
chain.
constructChain(List chain) { _interceptors.reversed.forEach((HttpInterceptor i) { // AngularJS has an optimization of not including null interceptors. chain.insert(0, [ i.request == null ? (x) => x : i.request, i.requestError]); chain.add([ i.response == null ? (x) => x : i.response, i.responseError]); }); }