diff --git a/src/index.ts b/src/index.ts index 402c7534..386f5f78 100644 --- a/src/index.ts +++ b/src/index.ts @@ -707,7 +707,7 @@ export default class Elysia< }) } - if (this.config.strictPath === false) { + if (!this.config.strictPath) { const loosePath = getLoosePath(path) this.router.dynamic.add(method, loosePath, { validator, diff --git a/test/core/elysia.test.ts b/test/core/elysia.test.ts index f646b5f5..31c28e54 100644 --- a/test/core/elysia.test.ts +++ b/test/core/elysia.test.ts @@ -228,4 +228,30 @@ describe('Edge Case', () => { expect(responses).toEqual(['AB', 'BA']) }) + + describe("aot configuration should not change the default setting", () => { + const route = new Elysia({ prefix: '/api' }).get( + '/', + () => 'pong', + ) + it('aot is on', async () => { + const app = new Elysia().use(route) + + const response = await Promise.resolve( app + .fetch(new Request('http://localhost/api')) ) + .then((x) => x.text()) + + expect(response).toBe('pong') + }) + + it('aot is off', async () => { + const app = new Elysia({ aot: false }).use(route) + + const response = await Promise.resolve(app + .fetch(new Request('http://localhost/api'))) + .then((x) => x.text()) + + expect(response).toBe('pong') + }) + }) })