Skip to content

Commit

Permalink
Merge pull request #27767 from backstage/patch-release-pr-27751
Browse files Browse the repository at this point in the history
Patch release of #27751
  • Loading branch information
Rugvip authored Nov 21, 2024
2 parents a2a93c3 + fe7f896 commit ffd0415
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "root",
"version": "1.33.3",
"version": "1.33.4",
"private": true,
"repository": {
"type": "git",
Expand Down
7 changes: 7 additions & 0 deletions packages/backend-legacy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# example-backend-legacy

## 0.2.107

### Patch Changes

- Updated dependencies
- @backstage/plugin-app-backend@0.4.2

## 0.2.106

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-legacy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "example-backend-legacy",
"version": "0.2.106",
"version": "0.2.107",
"backstage": {
"role": "backend"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/backend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# example-backend

## 0.0.35

### Patch Changes

- Updated dependencies
- @backstage/plugin-app-backend@0.4.2

## 0.0.34

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "example-backend",
"version": "0.0.34",
"version": "0.0.35",
"backstage": {
"role": "backend"
},
Expand Down
6 changes: 6 additions & 0 deletions plugins/app-backend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @backstage/plugin-app-backend

## 0.4.2

### Patch Changes

- 087c675: Fix root route handling when query parameters are present

## 0.4.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion plugins/app-backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-app-backend",
"version": "0.4.1",
"version": "0.4.2",
"description": "A Backstage backend plugin that serves the Backstage frontend app",
"backstage": {
"role": "backend-plugin",
Expand Down
47 changes: 25 additions & 22 deletions plugins/app-backend/src/service/appPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,34 +93,37 @@ describe('appPlugin', () => {
],
});

const rootContent = await fetch(`http://localhost:${server.port()}`).then(
res => res.text(),
);

expect(rootContent).toBe(`<html><head>
const baseUrl = `http://localhost:${server.port()}`;
const withInjectedConfig = `<html><head>
<script type="backstage.io/config">
[]
</script>
</head></html>`);
</head></html>`;

const indexContent = await fetch(
`http://localhost:${server.port()}/index.html`,
).then(res => res.text());
await expect(fetch(`${baseUrl}`).then(res => res.text())).resolves.toBe(
withInjectedConfig,
);

expect(indexContent).toBe(`<html><head>
<script type="backstage.io/config">
[]
</script>
</head></html>`);
await expect(
fetch(`${baseUrl}?foo=bar`).then(res => res.text()),
).resolves.toBe(withInjectedConfig);

const htmlContent = await fetch(
`http://localhost:${server.port()}/api/app/some/html5/route`,
).then(res => res.text());
await expect(
fetch(`${baseUrl}/index.html`).then(res => res.text()),
).resolves.toBe(withInjectedConfig);

expect(htmlContent).toBe(`<html><head>
<script type="backstage.io/config">
[]
</script>
</head></html>`);
await expect(
fetch(`${baseUrl}/index.html?foo=bar`).then(res => res.text()),
).resolves.toBe(withInjectedConfig);

await expect(
fetch(`${baseUrl}/api/app/some/html5/route`).then(res => res.text()),
).resolves.toBe(withInjectedConfig);

await expect(
fetch(`${baseUrl}/api/app/some/html5/route?foo=bar`).then(res =>
res.text(),
),
).resolves.toBe(withInjectedConfig);
});
});
2 changes: 1 addition & 1 deletion plugins/app-backend/src/service/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ async function createEntryPointRouter({
const rootRouter = Router();
rootRouter.use((req, _res, next) => {
// Make sure / and /index.html are handled by the HTML5 route below
if (req.url === '/' || req.url === '/index.html') {
if (req.path === '/' || req.path === '/index.html') {
next('router');
} else {
next();
Expand Down

0 comments on commit ffd0415

Please sign in to comment.