Skip to content

Commit 9f9d4e7

Browse files
committed
self-review
1 parent 97077a9 commit 9f9d4e7

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/cookies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ type Updater<T> = T | ((value: T) => T)
125125
export class Cookie<T> implements ElysiaCookie {
126126
constructor(
127127
private name: string,
128-
// Modifications here lead to changes in the response headers. Initially empty.
128+
// Modifications here lead to changes in the response headers. Empty at the start of a request.
129129
private jar: Record<string, ElysiaCookie>,
130130
private readonly initial: Partial<ElysiaCookie> = {}
131131
) {}

test/cookie/unchanged.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ describe('Cookie - Unchanged Values', () => {
108108
expect(response.headers.getAll('set-cookie').length).toBeGreaterThan(0)
109109
})
110110

111-
it('cookie handling should be idempotent', async () => {
111+
it('should idempotently create headers on cookie modifications', async () => {
112112
const app = new Elysia().post('/update', ({ cookie: { data } }) => {
113113
// Set to same value as incoming cookie
114114
data.value = { id: 123, name: 'test' }
@@ -132,7 +132,6 @@ describe('Cookie - Unchanged Values', () => {
132132
})
133133
)
134134

135-
// Should not send Set-Cookie since value didn't change
136135
expect(secondRes.headers.getAll('set-cookie').length).toBe(1)
137136
})
138137

0 commit comments

Comments
 (0)