From db5547905e7ea4edde5fa3f87f8ca0859c6ffac7 Mon Sep 17 00:00:00 2001 From: Braden Wong <13159333+braden-w@users.noreply.github.com> Date: Fri, 5 Dec 2025 16:47:17 -0800 Subject: [PATCH 1/2] docs: use string status names consistently across remaining files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert remaining numeric status codes to descriptive strings: - status(401) → status("Unauthorized") in auth contexts - status(400) → status("Bad Request") or status("Unauthorized") as appropriate Files updated: - docs/index.md (homepage examples) - docs/integrations/better-auth.md - docs/tutorial/patterns/extends-context/index.md - docs/patterns/extends-context.md - docs/eden/treaty/response.md --- docs/eden/treaty/response.md | 4 ++-- docs/index.md | 6 +++--- docs/integrations/better-auth.md | 2 +- docs/patterns/extends-context.md | 2 +- docs/tutorial/patterns/extends-context/index.md | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/eden/treaty/response.md b/docs/eden/treaty/response.md index 7aca25db..baf90610 100644 --- a/docs/eden/treaty/response.md +++ b/docs/eden/treaty/response.md @@ -30,7 +30,7 @@ import { treaty } from '@elysiajs/eden' const app = new Elysia() .post('/user', ({ body: { name }, status }) => { - if(name === 'Otto') return status(400) + if(name === 'Otto') return status("Bad Request") return name }, { @@ -146,7 +146,7 @@ import { treaty, Treaty } from '@elysiajs/eden' const app = new Elysia() .post('/user', ({ body: { name }, status }) => { - if(name === 'Otto') return status(400) + if(name === 'Otto') return status("Bad Request") return name }, { diff --git a/docs/index.md b/docs/index.md index 2d526ac9..aa5ff54a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -112,7 +112,7 @@ const role = new Elysia({ name: 'macro' }) role: (type: 'user' | 'staff' | 'admin') => ({ beforeHandle({ headers, status }) { if(headers.authorization !== type) - return status(401) + return status("Unauthorized") } }) }) @@ -159,7 +159,7 @@ export const auth = new Elysia() ssid: t.String() }), resolve({ cookie, status }) { - if(!cookie.ssid.value) return status(401) + if(!cookie.ssid.value) return status("Unauthorized") return { user: cookie.ssid.value @@ -189,7 +189,7 @@ export const auth = new Elysia() ssid: t.String() }), resolve({ cookie, status }) { - if(!cookie.ssid.value) return status(401) + if(!cookie.ssid.value) return status("Unauthorized") return { user: cookie.ssid.value diff --git a/docs/integrations/better-auth.md b/docs/integrations/better-auth.md index 516b3e32..cc447d5b 100644 --- a/docs/integrations/better-auth.md +++ b/docs/integrations/better-auth.md @@ -189,7 +189,7 @@ const betterAuth = new Elysia({ name: 'better-auth' }) headers }) - if (!session) return status(401) + if (!session) return status("Unauthorized") return { user: session.user, diff --git a/docs/patterns/extends-context.md b/docs/patterns/extends-context.md index 54be66a7..5cb02c21 100644 --- a/docs/patterns/extends-context.md +++ b/docs/patterns/extends-context.md @@ -317,7 +317,7 @@ new Elysia() .derive(({ headers, status }) => { const auth = headers['authorization'] - if(!auth) return status(400) + if(!auth) return status("Unauthorized") return { bearer: auth?.startsWith('Bearer ') ? auth.slice(7) : null diff --git a/docs/tutorial/patterns/extends-context/index.md b/docs/tutorial/patterns/extends-context/index.md index 74f65d4b..5a9021ba 100644 --- a/docs/tutorial/patterns/extends-context/index.md +++ b/docs/tutorial/patterns/extends-context/index.md @@ -161,7 +161,7 @@ new Elysia() ) }) .resolve(({ query: { age }, status }) => { - if(!age) return status(401) + if(!age) return status("Unauthorized") return { age } }) From 05c2a70621870da45faedc6c78af5507f3dbaf6f Mon Sep 17 00:00:00 2001 From: Braden Wong Date: Fri, 5 Dec 2025 17:35:44 -0800 Subject: [PATCH 2/2] style: use single quotes for status strings --- docs/eden/treaty/response.md | 4 ++-- docs/index.md | 6 +++--- docs/integrations/better-auth.md | 2 +- docs/patterns/extends-context.md | 2 +- docs/tutorial/patterns/extends-context/index.md | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/eden/treaty/response.md b/docs/eden/treaty/response.md index baf90610..7eee3005 100644 --- a/docs/eden/treaty/response.md +++ b/docs/eden/treaty/response.md @@ -30,7 +30,7 @@ import { treaty } from '@elysiajs/eden' const app = new Elysia() .post('/user', ({ body: { name }, status }) => { - if(name === 'Otto') return status("Bad Request") + if(name === 'Otto') return status('Bad Request') return name }, { @@ -146,7 +146,7 @@ import { treaty, Treaty } from '@elysiajs/eden' const app = new Elysia() .post('/user', ({ body: { name }, status }) => { - if(name === 'Otto') return status("Bad Request") + if(name === 'Otto') return status('Bad Request') return name }, { diff --git a/docs/index.md b/docs/index.md index aa5ff54a..0ec75685 100644 --- a/docs/index.md +++ b/docs/index.md @@ -112,7 +112,7 @@ const role = new Elysia({ name: 'macro' }) role: (type: 'user' | 'staff' | 'admin') => ({ beforeHandle({ headers, status }) { if(headers.authorization !== type) - return status("Unauthorized") + return status('Unauthorized') } }) }) @@ -159,7 +159,7 @@ export const auth = new Elysia() ssid: t.String() }), resolve({ cookie, status }) { - if(!cookie.ssid.value) return status("Unauthorized") + if(!cookie.ssid.value) return status('Unauthorized') return { user: cookie.ssid.value @@ -189,7 +189,7 @@ export const auth = new Elysia() ssid: t.String() }), resolve({ cookie, status }) { - if(!cookie.ssid.value) return status("Unauthorized") + if(!cookie.ssid.value) return status('Unauthorized') return { user: cookie.ssid.value diff --git a/docs/integrations/better-auth.md b/docs/integrations/better-auth.md index cc447d5b..7343b895 100644 --- a/docs/integrations/better-auth.md +++ b/docs/integrations/better-auth.md @@ -189,7 +189,7 @@ const betterAuth = new Elysia({ name: 'better-auth' }) headers }) - if (!session) return status("Unauthorized") + if (!session) return status('Unauthorized') return { user: session.user, diff --git a/docs/patterns/extends-context.md b/docs/patterns/extends-context.md index 5cb02c21..d360c52a 100644 --- a/docs/patterns/extends-context.md +++ b/docs/patterns/extends-context.md @@ -317,7 +317,7 @@ new Elysia() .derive(({ headers, status }) => { const auth = headers['authorization'] - if(!auth) return status("Unauthorized") + if(!auth) return status('Unauthorized') return { bearer: auth?.startsWith('Bearer ') ? auth.slice(7) : null diff --git a/docs/tutorial/patterns/extends-context/index.md b/docs/tutorial/patterns/extends-context/index.md index 5a9021ba..dfd5a434 100644 --- a/docs/tutorial/patterns/extends-context/index.md +++ b/docs/tutorial/patterns/extends-context/index.md @@ -161,7 +161,7 @@ new Elysia() ) }) .resolve(({ query: { age }, status }) => { - if(!age) return status("Unauthorized") + if(!age) return status('Unauthorized') return { age } })