-
-
Notifications
You must be signed in to change notification settings - Fork 422
patch 1.4.19 #1610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
patch 1.4.19 #1610
Changes from 7 commits
3143445
c95af80
97e8dee
80bb84d
e0b0534
2d30e61
620d96b
daaea8b
b0be99c
3a08c2d
d0cea55
aea3b06
2a86a8b
7f2bdd6
1e0a5d6
90b7940
9210318
3334797
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,13 @@ | ||
| import { Elysia, t } from '../src' | ||
| import * as z from 'zod' | ||
| import { post, req } from '../test/utils' | ||
| import { t, getSchemaValidator } from '../src' | ||
| import { sucrose } from '../src/sucrose' | ||
|
|
||
| const app = new Elysia({ | ||
| cookie: { | ||
| domain: "\\` + console.log(c.q='pwn2') }) //" | ||
| const v = sucrose({ | ||
| handler: (context) => { | ||
| console.log('path >>> ', context.path) | ||
| console.log(context) | ||
|
|
||
| return { id: 'test' } | ||
| } | ||
| }) | ||
| .get('/', ({ cookie: { session } }) => 'awd') | ||
|
|
||
| console.log(app.routes[0].compile().toString()) | ||
|
|
||
| const root = await app.handle( | ||
| new Request('http://localhost/', { | ||
| headers: { | ||
| Cookie: 'session=1234' | ||
| } | ||
| }) | ||
| ) | ||
|
|
||
| console.log(await root.text()) | ||
| console.log(v) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -694,47 +694,68 @@ describe('Dynamic Mode', () => { | |
| }) | ||
| }) | ||
|
|
||
| it('handle query array reference in multiple reference format', async () => { | ||
| const IdsModel = new Elysia().model({ | ||
| name: t.Object({ | ||
| name: t.Array(t.String()) | ||
| }) | ||
| }) | ||
|
|
||
| const app = new Elysia({ aot: false }) | ||
| .use(IdsModel) | ||
| .get('/', ({ query }) => query, { | ||
| name: 'ids' | ||
| }) | ||
|
|
||
| const data = await app | ||
| .handle(req('/?names=rapi&names=anis')) | ||
| .then((x) => x.json()) | ||
|
|
||
| expect(data).toEqual({ | ||
| names: ['rapi', 'anis'] | ||
| }) | ||
| }) | ||
|
|
||
| it('handle query array reference in multiple reference format', async () => { | ||
| const IdsModel = new Elysia().model({ | ||
| name: t.Object({ | ||
| name: t.Array(t.String()) | ||
| }) | ||
| }) | ||
| it('call local afterResponse on aot: false', async () => { | ||
| let called = false | ||
|
|
||
| const app = new Elysia({ aot: false }) | ||
| .use(IdsModel) | ||
| .get('/', ({ query }) => query, { | ||
| name: 'ids' | ||
| }) | ||
|
|
||
| const data = await app | ||
| .handle(req('/?names=rapi&names=anis')) | ||
| .then((x) => x.json()) | ||
|
|
||
| expect(data).toEqual({ | ||
| names: ['rapi', 'anis'] | ||
| }) | ||
| }) | ||
| .guard( | ||
| { | ||
| afterResponse: () => { | ||
| called = true | ||
| } | ||
| }, | ||
| (app) => app.get('/test', () => 'afterResponse') | ||
| ) | ||
| .get('/', () => 'hi') | ||
|
|
||
| const value = await app.handle(req('/test')).then((x) => x.text()) | ||
| await Bun.sleep(6.7) | ||
|
|
||
| expect(value).toBe('afterResponse') | ||
| expect(called).toBeTrue() | ||
| }) | ||
|
Comment on lines
+697
to
+716
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Bun.sleep expects milliseconds (number) — or a Date to sleep until. Example: await Bun.sleep(1000) sleeps ~1000 ms. Bun.sleepSync also uses milliseconds. [1][2][3] Sources: 🏁 Script executed: cd test/core && wc -l dynamic.test.tsRepository: elysiajs/elysia Length of output: 78 🏁 Script executed: sed -n '697,750p' test/core/dynamic.test.tsRepository: elysiajs/elysia Length of output: 1346 Make afterResponse timing in this test more robust and remove dead code The new Consider either:
Additionally, the large commented-out block of duplicate "handle query array reference…" tests immediately below this test should be deleted entirely rather than left commented. 🤖 Prompt for AI Agents |
||
|
|
||
| // it('handle query array reference in multiple reference format', async () => { | ||
| // const IdsModel = new Elysia().model({ | ||
| // name: t.Object({ | ||
| // name: t.Array(t.String()) | ||
| // }) | ||
| // }) | ||
|
|
||
| // const app = new Elysia({ aot: false }) | ||
| // .use(IdsModel) | ||
| // .get('/', ({ query }) => query, { | ||
| // query: 'name' | ||
| // }) | ||
|
|
||
| // const data = await app | ||
| // .handle(req('/?names=rapi&names=anis')) | ||
| // .then((x) => x.json()) | ||
|
|
||
| // expect(data).toEqual({ | ||
| // names: ['rapi', 'anis'] | ||
| // }) | ||
| // }) | ||
|
|
||
| // it('handle query array reference in multiple reference format', async () => { | ||
| // const IdsModel = new Elysia().model({ | ||
| // name: t.Object({ | ||
| // name: t.Array(t.String()) | ||
| // }) | ||
| // }) | ||
|
|
||
| // const app = new Elysia({ aot: false }) | ||
| // .use(IdsModel) | ||
| // .get('/', ({ query }) => query, { | ||
| // query: 'name' | ||
| // }) | ||
|
|
||
| // const data = await app | ||
| // .handle(req('/?names=rapi&names=anis')) | ||
| // .then((x) => x.json()) | ||
|
|
||
| // expect(data).toEqual({ | ||
| // names: ['rapi', 'anis'] | ||
| // }) | ||
| // }) | ||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.