Avoid using Headers as it is not supported in the backend

Signed-off-by: Dominik Henneke <dominik.henneke@sda-se.com>
This commit is contained in:
Dominik Henneke
2021-03-30 11:34:24 +02:00
parent ee01dcf9a3
commit b196a45691
2 changed files with 14 additions and 9 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/catalog-client': patch
---
Avoid using Headers as it is not supported in the backend
+9 -9
View File
@@ -191,9 +191,9 @@ export class CatalogClient implements CatalogApi {
options?: CatalogRequestOptions,
): Promise<void> {
const url = `${await this.discoveryApi.getBaseUrl('catalog')}${path}`;
const headers = new Headers(
options?.token ? { Authorization: `Bearer ${options.token}` } : {},
);
const headers: Record<string, string> = options?.token
? { Authorization: `Bearer ${options.token}` }
: {};
const response = await fetch(url, { method, headers });
if (!response.ok) {
@@ -207,9 +207,9 @@ export class CatalogClient implements CatalogApi {
options?: CatalogRequestOptions,
): Promise<any> {
const url = `${await this.discoveryApi.getBaseUrl('catalog')}${path}`;
const headers = new Headers(
options?.token ? { Authorization: `Bearer ${options.token}` } : {},
);
const headers: Record<string, string> = options?.token
? { Authorization: `Bearer ${options.token}` }
: {};
const response = await fetch(url, { method, headers });
if (!response.ok) {
@@ -225,9 +225,9 @@ export class CatalogClient implements CatalogApi {
options?: CatalogRequestOptions,
): Promise<any | undefined> {
const url = `${await this.discoveryApi.getBaseUrl('catalog')}${path}`;
const headers = new Headers(
options?.token ? { Authorization: `Bearer ${options.token}` } : {},
);
const headers: Record<string, string> = options?.token
? { Authorization: `Bearer ${options.token}` }
: {};
const response = await fetch(url, { method, headers });
if (!response.ok) {