From 475a2211fc47f416308d088fbe61edff24a7e2f7 Mon Sep 17 00:00:00 2001 From: Venu Date: Mon, 25 Feb 2019 07:37:13 -0500 Subject: [PATCH] 4345- Text File Viewer withCredentials (#4349) * 4345-Text File Viewer not passing withCredentials * added new line --- lib/core/viewer/components/txtViewer.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/core/viewer/components/txtViewer.component.ts b/lib/core/viewer/components/txtViewer.component.ts index e344360e39..23f4331442 100644 --- a/lib/core/viewer/components/txtViewer.component.ts +++ b/lib/core/viewer/components/txtViewer.component.ts @@ -18,6 +18,7 @@ import { HttpClient } from '@angular/common/http'; import { Component, Input, OnChanges, ViewEncapsulation } from '@angular/core'; import { SimpleChanges } from '@angular/core'; +import { AppConfigService } from './../../app-config/app-config.service'; @Component({ selector: 'adf-txt-viewer', @@ -36,7 +37,7 @@ export class TxtViewerComponent implements OnChanges { content: string | ArrayBuffer; - constructor(private http: HttpClient) { + constructor(private http: HttpClient, private appConfigService: AppConfigService) { } ngOnChanges(changes: SimpleChanges): Promise { @@ -57,8 +58,10 @@ export class TxtViewerComponent implements OnChanges { } private getUrlContent(url: string): Promise { + let withCredentialsMode = this.appConfigService.get('auth.withCredentials', false); + return new Promise((resolve, reject) => { - this.http.get(url, { responseType: 'text' }).subscribe((res) => { + this.http.get(url, { responseType: 'text', withCredentials: withCredentialsMode }).subscribe((res) => { this.content = res; resolve(); }, (event) => {