Skip to content

Instantly share code, notes, and snippets.

@tomasstankovic
Last active August 11, 2016 19:00
Show Gist options
  • Save tomasstankovic/faeb754c5158d34853461c70ca8b40b6 to your computer and use it in GitHub Desktop.
Save tomasstankovic/faeb754c5158d34853461c70ca8b40b6 to your computer and use it in GitHub Desktop.
Angular 2 Http interceptor / HTTP GET request
get(url: string, options?: RequestOptionsArgs): Observable<any> {
this.requestInterceptor();
return super.get(this.getFullUrl(url), this.requestOptions(options))
.catch(this.onCatch)
.do((res: Response) => {
this.onSubscribeSuccess(res);
}, (error: any) => {
this.onSubscribeError(error);
})
.finally(() => {
this.onFinally();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment