Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-06-08 13:32:52 +02:00
parent bc98948d15
commit 19781483a2
3 changed files with 17 additions and 7 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-app-api': patch
---
Handle URLs as the first argument to `fetchApi`, when using the `plugin:` protocol
@@ -55,7 +55,14 @@ export class PluginProtocolResolverFetchMiddleware implements FetchMiddleware {
}
const target = `${join(base, pathname)}${search}${hash}`;
return next(target, typeof input === 'string' ? init : input);
return next(
target,
typeof input === 'string' || isUrl(input) ? init : input,
);
};
}
}
function isUrl(a: unknown): a is URL {
return typeof a === 'object' && a?.constructor === URL;
}
+4 -6
View File
@@ -73,12 +73,10 @@ export class Generators implements GeneratorBuilder {
export const getDocFilesFromRepository: (
reader: UrlReader,
entity: Entity,
opts?:
| {
etag?: string | undefined;
logger?: Logger | undefined;
}
| undefined,
opts?: {
etag?: string;
logger?: Logger;
},
) => Promise<PreparerResponse>;
// @public