Skip to content

Commit c960b31

Browse files
committed
Fix Bing API search issue
1 parent 6871613 commit c960b31

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/services/FilesSearchService.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,9 @@ export class FilesSearchService {
144144
}
145145

146146
// Submit the request
147-
const apiUrl: string = `https://api.cognitive.microsoft.com/bing/v7.0/images/search?traffictype=Internal_monitor&q=${encodeURIComponent(query)}&count=${maxResults}&aspect=${aspect}&maxFileSize=${maxFileSize}&mkt=en-US&size=${size}&license=${license}`;
148-
const headers = new Headers({
149-
'Ocp-Apim-Subscription-Key': this.bingAPIKey
150-
});
151-
const searchDataResponse: any = await this.context.httpClient.get(apiUrl, SPHttpClient.configurations.v1, {
152-
headers: headers,
147+
const apiUrl: string = `https://www.bingapis.com/api/v7/images/search?appid=${this.bingAPIKey}&traffictype=Internal_monitor&q=${encodeURIComponent(query)}&count=${maxResults}&aspect=${aspect}&maxFileSize=${maxFileSize}&size=${size}&mkt=en-US&license=${license}`;
148+
149+
const searchDataResponse: any = await this.context.httpClient.get(apiUrl, SPHttpClient.configurations.v1, {
153150
method: 'GET',
154151
mode: 'cors'
155152
});

0 commit comments

Comments
 (0)