Merge pull request #28453 from Andrzejewski-dev/master
chore: update getFile in BitbucketServerClient to use REST API path
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend-module-bitbucket-server': patch
|
||||
---
|
||||
|
||||
Updated the `getFile` method in `BitbucketServerClient` to use `this.config.apiBaseUrl` directly for constructing the API request URL, removing the creation of an unnecessary `URL` object. The method now relies on REST API paths for accessing resources instead of direct access, ensuring better alignment with Bitbucket's API conventions.
|
||||
+1
-1
@@ -153,7 +153,7 @@ describe('BitbucketServerClient', () => {
|
||||
it('getFile', async () => {
|
||||
server.use(
|
||||
rest.get(
|
||||
`https://${config.host}/projects/test-project/repos/test-repo/raw/catalog-info.yaml`,
|
||||
`${config.apiBaseUrl}/projects/test-project/repos/test-repo/raw/catalog-info.yaml`,
|
||||
(req, res, ctx) => {
|
||||
if (
|
||||
req.headers.get('authorization') !==
|
||||
|
||||
@@ -77,9 +77,8 @@ export class BitbucketServerClient {
|
||||
repo: string;
|
||||
path: string;
|
||||
}): Promise<Response> {
|
||||
const base = new URL(this.config.apiBaseUrl);
|
||||
return throttledFetch(
|
||||
`${base.protocol}//${base.host}/projects/${options.projectKey}/repos/${options.repo}/raw/${options.path}`,
|
||||
`${this.config.apiBaseUrl}/projects/${options.projectKey}/repos/${options.repo}/raw/${options.path}`,
|
||||
getBitbucketServerRequestOptions(this.config),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user