Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix COMPANION_PATH make sure it serves everything served behind that path fixes #3514 * add tests for subpath * chmod +x companion.sh * remove process.exit as it's considered harmful in this case an error thrown will also be printed to stderr * add backward compatible redirect * Apply suggestions from code review Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> * fix oops Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
- Loading branch information
Showing
7 changed files
with
91 additions
and
42 deletions.
There are no files selected for viewing
Empty file.
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
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
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,22 @@ | ||
const request = require('supertest') | ||
const { getServer } = require('../mockserver') | ||
|
||
it('can be served under a subpath', async () => { | ||
const server = getServer({ COMPANION_PATH: '/subpath' }) | ||
|
||
await request(server).get('/subpath').expect(200) | ||
await request(server).get('/subpath/metrics').expect(200) | ||
await request(server).get('/').expect(404) | ||
// todo in next major: | ||
await request(server).get('/metrics').expect(302) | ||
// await request(server).get('/metrics').expect(404) | ||
}) | ||
|
||
test('can be served without a subpath', async () => { | ||
const server = getServer() | ||
|
||
await request(server).get('/').expect(200) | ||
await request(server).get('/metrics').expect(200) | ||
await request(server).get('/subpath').expect(404) | ||
await request(server).get('/subpath/metrics').expect(404) | ||
}) |
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