Skip to content

Commit db1666f

Browse files
committed
Fixing embedded test editor to not send auth headers to triggerFunctionAPIM
1 parent 926a33d commit db1666f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

AzureFunctions.AngularClient/src/app/function/embedded/embedded-function-test-tab/embedded-function-test-tab.component.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { BroadcastEvent } from 'app/shared/models/broadcast-event';
1717
import { Subject } from 'rxjs/Subject';
1818
import { Component, OnInit, ViewChild, Output, Input, OnChanges, SimpleChange, ContentChildren, QueryList, OnDestroy } from '@angular/core';
1919
import { BroadcastService } from 'app/shared/services/broadcast.service';
20+
import { Headers } from '@angular/http';
2021

2122
@Component({
2223
selector: 'embedded-function-test-tab',
@@ -147,7 +148,12 @@ export class EmbeddedFunctionTestTabComponent implements OnInit, OnChanges, OnDe
147148
url: this._functionInfo.trigger_url
148149
};
149150

150-
this._cacheService.post('/api/triggerFunctionAPIM', true, null, content)
151+
const headers = new Headers();
152+
headers.append('Content-Type', 'application/json');
153+
headers.append('Accept', 'application/json');
154+
headers.append('Cache-Control', 'no-cache');
155+
156+
this._cacheService.post('/api/triggerFunctionAPIM', true, headers, content)
151157
.subscribe(r => {
152158
this._busyManager.clearBusy();
153159
this.responseOutputText = r.text();

server/src/actions/apim.ts

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ interface TriggerRequest{
88
}
99

1010
export function triggerFunctionAPIM(req: Request, res: Response){
11+
if(!process.env.APIMSubscriptionKey){
12+
res.status(500).send('APIMSubscriptionKey is not defined');
13+
return;
14+
}
15+
1116
const content = req.body as TriggerRequest;
1217
const headers: IncomingMessageHeaders = { };
1318
headers['Content-Type'] = 'application/json';

0 commit comments

Comments
 (0)