-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for serving well-known URIs with the @astrojs/node SSR ad…
…apter (#5832)
- Loading branch information
Showing
10 changed files
with
84 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'astro': minor | ||
'@astrojs/node': minor | ||
--- | ||
|
||
Add support for serving well-known URIs with the @astrojs/node SSR adapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/astro/test/fixtures/static-build-ssr/public/.well-known/apple-app-site-association
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"applinks": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/integrations/node/test/fixtures/well-known-locations/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "@test/well-known-locations", | ||
"version": "0.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"astro": "workspace:*", | ||
"@astrojs/node": "workspace:*" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/integrations/node/test/fixtures/well-known-locations/public/.hidden/file.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
3 changes: 3 additions & 0 deletions
3
...ons/node/test/fixtures/well-known-locations/public/.well-known/apple-app-site-association
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"applinks": {} | ||
} |
45 changes: 45 additions & 0 deletions
45
packages/integrations/node/test/well-known-locations.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import nodejs from '../dist/index.js'; | ||
import { loadFixture } from './test-utils.js'; | ||
import { expect } from 'chai'; | ||
|
||
describe('test URIs beginning with a dot', () => { | ||
/** @type {import('./test-utils').Fixture} */ | ||
let fixture; | ||
|
||
before(async () => { | ||
fixture = await loadFixture({ | ||
root: './fixtures/well-known-locations/', | ||
output: 'server', | ||
adapter: nodejs({ mode: 'standalone' }), | ||
}); | ||
await fixture.build(); | ||
}); | ||
|
||
describe('can load well-known URIs', async () => { | ||
let devPreview; | ||
|
||
before(async () => { | ||
devPreview = await fixture.preview(); | ||
}); | ||
|
||
after(async () => { | ||
await devPreview.stop(); | ||
}); | ||
|
||
it('can load a valid well-known URI', async () => { | ||
const res = await fixture.fetch('/.well-known/apple-app-site-association'); | ||
|
||
expect(res.status).to.equal(200); | ||
|
||
const json = await res.json(); | ||
|
||
expect(json).to.deep.equal({ applinks: {} }); | ||
}); | ||
|
||
it('cannot load a dot folder that is not a well-known URI', async () => { | ||
const res = await fixture.fetch('/.hidden/file.json'); | ||
|
||
expect(res.status).to.equal(404); | ||
}); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.