Skip to content

Commit a345561

Browse files
committed
Remove Authorization header from being sent for templates/bindings in try scenario
1 parent 8e26c9c commit a345561

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

AzureFunctions.AngularClient/src/app/shared/services/function-app.service.ts

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { GlobalStateService } from './global-state.service';
12
import { Host } from './../models/host';
23
import { ArmSiteDescriptor } from './../resourceDescriptors';
34
import { HttpMethods, HttpConstants } from './../models/constants';
@@ -156,6 +157,7 @@ export class FunctionAppService {
156157
private _userService: UserService,
157158
private _injector: Injector,
158159
private _portalService: PortalService,
160+
private _globalStateService: GlobalStateService,
159161
logService: LogService) {
160162

161163
this.runtime = new ConditionalHttpClient(_cacheService, logService, context => this.getRuntimeToken(context), 'NoClientCertificate', 'NotOverQuota', 'NotStopped', 'ReachableLoadballancer');
@@ -301,10 +303,15 @@ export class FunctionAppService {
301303
return this.azure.executeWithConditions([], context, t =>
302304
this.getExtensionVersionFromAppSettings(context)
303305
.mergeMap(extensionVersion => {
306+
const headers = this.portalHeaders(t);
307+
if (this._globalStateService.showTryView) {
308+
headers.delete('Authorization');
309+
}
310+
304311
return this._cacheService.get(
305312
Constants.serviceHost + 'api/templates?runtime=' + (extensionVersion || 'latest'),
306313
true,
307-
this.portalHeaders(t));
314+
headers);
308315
})
309316
.map(r => {
310317
const object = r.json();
@@ -567,8 +574,18 @@ export class FunctionAppService {
567574
}
568575

569576
return this.azure.execute(context, t => this.getExtensionVersionFromAppSettings(context)
570-
.concatMap(extensionVersion =>
571-
this._cacheService.get(`${Constants.serviceHost}api/bindingconfig?runtime=${extensionVersion}`, false, this.portalHeaders(t)))
577+
.concatMap(extensionVersion => {
578+
if (!extensionVersion) {
579+
extensionVersion = 'latest';
580+
}
581+
582+
const headers = this.portalHeaders(t);
583+
if(this._globalStateService.showTryView){
584+
headers.delete('Authorization');
585+
}
586+
587+
return this._cacheService.get(`${Constants.serviceHost}api/bindingconfig?runtime=${extensionVersion}`, false, headers)
588+
})
572589
.map(r => {
573590
const object = r.json();
574591
this.localize(object);

0 commit comments

Comments
 (0)