private performRequest()

in src/app/common/http-client.ts [119:164]


    private performRequest(conn: ApiConnection, url: string, options?: RequestOptionsArgs, warn?: boolean): Observable<Response> {
        let reqOpt = new RequestOptions(options);

        if (url.toString().indexOf("/") != 0) {
            url = '/' + url;
        }

        reqOpt.url = conn.url + '/api' + url;
        let req = new Request(reqOpt);
        //
        // Set Access-Token
        req.headers.set('Access-Token', 'Bearer ' + conn.accessToken);
        return this._http.request(req).pipe(
            catchError(e => {
                // Status code 0 possible causes:
                // Untrusted certificate
                // Windows auth, prevents CORS headers from being accessed
                // Service not responding
                if (e instanceof Response) {
                    if (e.status == 0) {
                        return this._http.request(req).pipe(
                            catchError(err => {
                                // Check to see if connected
                                return this._http.options(this._conn.url).pipe(
                                    catchError((e, _) => {
                                        this._connectSvc.reconnect();
                                        return throwError(e)
                                    }),
                                    finalize(() => {
                                        this.handleHttpError(err);
                                    })
                                )})
                        )
                    }
                    this.handleHttpError(e, warn);
                    return throwError(e)
                }
                let apiError = <ApiError>({
                    title: "unknown error",
                    detail: JSON.stringify(e),
                })
                this._notificationService.apiError(apiError)
                return throwError(apiError)
            })
        )
    }